Question: (40%) write a compiler tool that can scan the C++ source code file named Input-cpp and generate an output file called Input new.cpp, which will
(40%) write a compiler tool that can scan the C++ source code file named "Input-cpp" and generate an output file called "Input new.cpp", which will remove the comments of the input file. 6. You can assume the file name is fixed. And you can assume the input file is well formed, i.e., all the strings "/" and "* appear in pairs. There does not exist unpairedcommends. You need to review the functions in Chapter 3, you may need some of those functions, such as get, ignore, peak putback, etc. Although the functions introduced in Chapter 3 is for iostream, it can also be invoked by fstream. More details can be found in http://www.cplusplus.com/reference/fstream/fstream/ Sample input and output: Sample code ne Eu #include iostream> //std::cout, std: cin, l O library #includeiomanip> //stdsetwo, std::setfill() int main0 declare the variable int startHour, startMinute, endHour, endMinute; /l input std:cout > startHour std:cin.get0;// skip : read one char but do nothing std:cin >> startMinute; std:cout endHour std:cin.get0;/ skip std::cin >> endMinute /l process int hrDiff 0, minDiff 0; I ADD CODE 1 ll output / ADD CODE 2 return 0; ) I/ end mairn
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
