/** 10. Create a text file containing integers, letters and whitespaces (remember that whitespaces include space, tab and newline characters). Write a C++ program that replaces each white space by * and writes the result to another text file. The program should work for arbitrary input file lengths. **/ #include #include #include using namespace std; int main () { char c; char in_name[20]; char out_name[20]; ifstream infile; ofstream outfile; cout<< "Enter input file name\n"; cin>>in_name; infile.open(in_name); if(infile.fail()){ cout<<"Failed to open input file\n"; exit(1); } cout<< "Enter output file name\n"; cin>>out_name; outfile.open(out_name,ios::out); if(outfile.fail()){ cout<<"Failed to open output file\n"; exit(1); } while (!infile.eof()){ infile.get(c); if(isspace(c)) outfile.put('*'); else outfile.put(c); } infile.close(); outfile.close(); }