Question: Write a C++ program that remove comments from a text file. More specifically, given an input file (input.txt) your program will produce an output file
Write a C++ program that remove comments from a text file. More specifically, given an input file (input.txt) your program will produce an output file (output.txt) which is an exact copy of the input, but does the output does not contain lines for which the first two non-whitespace characters are //. You are not required to remove comments when // characters are after non-whitespace characters.
sample input.txt:
Hello World
// My first comment!
/ This is not really a comment
// This comment is indented!
ABC // This is a comment you do not need to handle
following output:
Hello World
/ This is not really a comment
ABC // This is a comment you do not need to handle
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
