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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started