N
~neil~
Hello
I've been learning C for over the last couple months ON MY OWN, and
I'm trying to solve this program.
How do you decode a number in each case in a switch from 0 to 9 which
will save the text of each number? EX. case 7: will output "seven" in
the Printf statement. Problem is it's in a loop, each number is
extracted from the user input(scanf statement) like 2057 % 10 will
extract the 7, then 5, then 0, then 2 in each pass of the loop. The
remaining number(s)like 205 after the extraction is put in a "int
variable" called "hold"
The program output looks like this:
Enter a number > 2057
The digits you entered:
Seven,Five,Zero,Two
press any key to continue........
I tried bringing out the text using #define ON "one".This is NOT
homework you guys! I have a book "Learning C Step By Step" by Jean
Paul Corriveau, which is the toughest program I've come accross so
far.I can extract each number in each case for the switch,
however I'm confused on what code to use in each case for the
output(printf)??
The while loop I construsted is infinite, I use CTRL-C to escape.
I suspect the progam uses character array(s) or strings, but I have
limited knowledge of "C"
If your wondering, I was going to take "C" at my college this year
starting in september,there are NO summer classes offered for this
course,it's $1250 bucks for 300 hours of in class instruction.
Any help with the code would be great?
Sincerely
~neil~
I've been learning C for over the last couple months ON MY OWN, and
I'm trying to solve this program.
How do you decode a number in each case in a switch from 0 to 9 which
will save the text of each number? EX. case 7: will output "seven" in
the Printf statement. Problem is it's in a loop, each number is
extracted from the user input(scanf statement) like 2057 % 10 will
extract the 7, then 5, then 0, then 2 in each pass of the loop. The
remaining number(s)like 205 after the extraction is put in a "int
variable" called "hold"
The program output looks like this:
Enter a number > 2057
The digits you entered:
Seven,Five,Zero,Two
press any key to continue........
I tried bringing out the text using #define ON "one".This is NOT
homework you guys! I have a book "Learning C Step By Step" by Jean
Paul Corriveau, which is the toughest program I've come accross so
far.I can extract each number in each case for the switch,
however I'm confused on what code to use in each case for the
output(printf)??
The while loop I construsted is infinite, I use CTRL-C to escape.
I suspect the progam uses character array(s) or strings, but I have
limited knowledge of "C"
If your wondering, I was going to take "C" at my college this year
starting in september,there are NO summer classes offered for this
course,it's $1250 bucks for 300 hours of in class instruction.
Any help with the code would be great?
Sincerely
~neil~