Question: The followving code skips line comments and block comments in a C/C++ program: II get two consecutive characters char cl, c2; cl - getc(inputFile); c2

 The followving code skips line comments and block comments in a

The followving code skips line comments and block comments in a C/C++ program: II get two consecutive characters char cl, c2; cl - getc(inputFile); c2 getc(inputFile); // skip a block comment cl-c2; c2=getc(inputFile); // skip a line comment while(c2 ') { cl-c2 c2-getc(inputFile); Complete the following program that reads a C/C++source file with comments and produces a pure source file without comments. Compile and test your program. The command line of this program is: skip file-with-comments file-without-comments center> Il skip.cpp #include int main int argc, char *argv FILE *inputFile, *outputFile; if(inputFile-fopen(argv[1], "r")) outputFile-fopen(argv[2], "w"); char c1, c2: // copy statements and skip comments here fclose(inputFile); fclose(outputFile); 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!