1. Engineering
  2. Computer Science
  3. this c program removes all whitespaces modify this program so...

Question: this c program removes all whitespaces modify this program so...

Question details

#include <iostream» #include <string> #include <fstream> using namespace std; 2 4. int main) { : string prgm; : cout <<Enter file name: ; 6 7 9 cin >> prgm; 10 ifstream in(prgm.c_str)); 12 13 14 15 16 17 18 19 20 21 if(in.is_open()) ofstream out ((prgm .bak).c_str)); char data; while : : (inget (data)) if (data !&& data!n && data r && data t&data If && data v) :out << data; :out.close( :in.close) 23 24 25 26 27 28 else t cout <<prgm < does not exists! << endl; system (pause); return Θ;

This C++ program removes all whitespaces. Modify this program so that it also removes any single line comments '//' and multi-line comments '/** */'. Quit the program if there is an error in the single or multi line comments, such as mutli line comments with only /** and no end. (This can be done via command line, but needs to be done in C++)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution