fscanf

Modify the previous scanf project with the following, additional specifications. The customer's orders will be read as integers from a file named fscanf_input.txt. You can assume that this text file is in the same folder as the exe file. The data in that file will consist of separate integers on separate lines. Use the following data as input for fscanf_input.txt when you run the program for a runtime grade:


John Doe
1
3
2
2
1
4
3
6.7
3
1
2
4
4

The output must be written to another file namedf fscanf_output.txt. No output should be displayed on the monitor. The output should be in the format

John Doe owes $176.27

where the total price is rounded to the nearest penny.

This program must compile and execute as a C program rathr than a C++ program. Specifically, the file extension of the source file must be .c instead of .cpp and it cannot make use of iostream, cin, cout, <<, >>, endl or any other non-C keywords or syntax.

Preconditions:

  • You are guaranteed that the first line of the file will contain the user's name which may include one or more spaces.
  • You are guaranteed that the rest of the file will consist of numbers on separate lines. The menu choices and quantities will be valid integer or floating-point values (in the case of peanuts).
  • You are guaranteed that the the last integer in the file will be a 4.

You must hand in the following on separate pages stapled in this specified order:

  1. The hardcopy source code for this assignment.Staple multiple pages together, if applicable.
  2. The fscanf_input.txt file that you used to test your program. The data is given above.
  3. The fscanf_output.text file that was produced when you used fscanf_input.txt as input.