Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will correct a C++ program that has errors in which operato

ID: 657530 • Letter: W

Question

Write a program that will correct a C++ program that has errors in which operator, << or >>, it uses with cin and cout. The program replaces each (incorrect) occurrence of

with the corrected version

and each (incorrect) occurrence of

with the corrected version

Allow for the possibility that there may be any number of whitespace characters (one or more) between cin and << and between cout and >>. The replacement corrected version has only one blank between the cin or cout and the following operator.

The program to be corrected is in a file with name

Explanation / Answer

#include #include #include #include #include #include #include using std::exit; using std::cin; using std::cout; using std::ostream; using std::istream; using std::ifstream; using std::ofstream; using std::endl; using std::pow; using std::sqrt; using std::getline; using std::string; using std::ios; using std::setw; const void correct(ifstream& fin,ofstream& fout); //Pre : fs1 & fs2 must exist,fs3 optional //Post : merge from fs1 and fs2 to fs3,then sort int main() { ifstream fin; ofstream fout; fin.open("original.txt"); if(fin.fail()) { cout next; if(next == '') { fin.get(next); if(next == '>') { fout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote