Question: THE FOLLOWING IS A C PROGRAM Design first and _then_ write a program that will read numbers (numeric digits) from an input file. The program

THE FOLLOWING IS A C PROGRAM

Design first and _then_ write a program that will read numbers (numeric digits) from an input file. The program will print the numbers onto the screen in their expanded word form. Your program will be organized into a series of functions. Main() will primarily contain function calls, some variables, and very few, if any, statements.

Your program should handle numbers up to (but not including) 10,000,000. You can choose whether to recognize numbers with commas in them or simply handle only numbers without commas.

Example:

5 - five

123 - one hundred twenty three

1212121 - one million, two hundred twelve thousand one hundred twenty one

(I will provide a .c file with main() and some other useful code in the next couple of days. In the meantime, work on how you will design the functions and algorithms. )

Your main() should look similar to this:

int main(void) {

// variable declarations

int i;

long number;

FILE *input = 0;

char fileName[255];

char numWord[255];

// program intro

printTitle();

// establish input file

while (!input) {

getFileName(fileName); // ask user for file name, store to fileName

input = getFileHandle(fileName); // try to open the file

} // loops until file is opened successfully

// Look through the file; convert digital numbers to words

i = 0;

while (number = getNextNumber(input)) { // loop until number is false (zero)

wordNum = expandToWords(number);

displayNum(number, wordNum);

i++;

}

printf("End of input file ");

printf("%d numbers found ", i);

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!