Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

How many multiples of 4 are there between 10 and 250?

Answered: 1 week ago

Question

2. What are your challenges in the creative process?

Answered: 1 week ago