Question: Question 3: C Programming (25 points) Using the preprocessor and a single C program source file create a program that when compiled and depending on

 Question 3: C Programming (25 points) Using the preprocessor and a

Question 3: C Programming (25 points) Using the preprocessor and a single C program source file create a program that when compiled and depending on the setting of a #define PROMPT argument will compile the program either as a command-line program or a prompt driven program. When we are compiling the source file in PROMPT mode there must be no code specific to the command-line, and the same goes the other way around. The program operates this way at the command-line: S sort original filename sorted filename Where "sort" is the name of the executable program you are creating. "original filename" is the name of an unsorted text file of integer numbers. One number on each line of the file. "sorted filename" is the filename of a text file that will contain all the numbers from the original file but in sorted order, from lowest to highest -each number on its own line. The prompt driven program will ask the user for the name of the original filename and the sorted_filename. It will then use the same sorting algorithm as the command-line version used If the original filename does not exist the program terminates prematurely with an error message indicating that the file was not found. If the sorted filename cannot be created or if it already exists then the program terminates prematurely with a message indicating for what reason it stopped early: unable to open file or file already exists. Create this program

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!