Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 23rd International Conference Dexa 2012 Vienna Austria September 2012 Proceedings Part 1 Lncs 7446

Authors: Stephen W. Liddle ,Klaus-Dieter Schewe ,A Min Tjoa ,Xiaofang Zhou

2012th Edition

3642325998, 978-3642325991

More Books

Students also viewed these Databases questions

Question

e. What do you know about your ethnic background?

Answered: 1 week ago

Question

b. Why were these values considered important?

Answered: 1 week ago