Impossible........ please help.
Write a C++ program that opens a text file with the name "Hello.txt", creates a second file "Hello1.txt". Read the content of Hello.txt and copy its contents to Hello1.txt " replacing every space character ' ' with a '_' character. Thus the text "The quick brown " in Hello.txt should become "The_quick_brown_" Close both files. Remember to include string and fstream. You will have to use the get function of your ifstream object.
please please help. I know how to do this question:
Write C++ code to open a file with the name Hello.txt, store the message
“Hello, World!” in the file, and close the file. Then open the same file
again and read the message into a string variable. Close the file again.
ofstream output_data;
output_data.open("Hello.txt");
output_data %26lt;%26lt; "Hello, World!";
output_data.close();
ifstream input_data;
input_data.open("Hello.txt");
string s;
getline(input_data, s);
input_data.close();
But I cannot get this one!
C++ help help help, almost can get it but not quite...?
This should send you in the right direction:
while (input_data.good())
{
c = input_data.get();
output_data %26lt;%26lt; convert_spaces(c);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment