Introduction
C,,,x,。
。
Requirement
Homework 7
Files to submit: bin_str.c
Time it took Matthew to Complete: 10 mins
• All programs must compile without warnings when using the -Wall and -Werror options
• Submit only the files requested
◦ Do NOT submit folders or compressed files such as .zip, .rar, .tar, .targz, etc
• Your program must match the output exactly to receive credit.
◦ Make sure that all prompts and output match mine exactly.
◦ Easiest way to do this is to copy and paste them
• All input will be valid unless stated otherwise
• Print all real numbers to two decimal places unless otherwise stated
• The examples provided in the prompts do not represent all possible input you can receive.
• All inputs in the examples in the prompt are underlined
◦ You don’t have to make anything underlined it is just there to help you differentiate between
what you are supposed to print and what is being given to your program
• If you have questions please post them on Piazza
Restrictions
• No global variables are allowed
• Your main function may only declare variables, call other functions, and assign
variables values.
• You must solve this problem recursively
1. Write a program called bin_str.c that completes a binary number. A binary
number is made up of 0’s and 1’s but the input strings you will receive can also
contain x’s. An x represents a digit that can be either a 0 or a 1. Your program
should display all the possible binary digits that can be formed. For example the
string x1x0 could represent either 0100, 0110, 1100, or 1110.
1. Your program should accept the binary string as a command line argument
2. You MUST solve this program RECURISIVELY
Examples
1../bin_str.out 0110
0110
2../bin_str.out 01x0
0100
0110
3../bin_str.out xx
00
01
10
11
4../bin_str.out 101x100x11x
10101000110
10101000111
10101001110
10101001111
10111000110
10111000111
10111001110
10111001111