Files using c++

Write a program to read and write a data file. While writing data follow the following instructions:
a)Add one space between two successive words.
b)Capitalize the first character of sentences.
c)If numerical data is present put them in bracket.


please help.... i am only able to write and read the data..... but not able to perform the given instructions.......
How come?
cout<<"\n Enter the string.... Press '.' to exit entering:\n";
getline(cin,s,'.');
ofstream outfile("tony1.txt");
for(i=0;i<s.size();j++)
outfile.put(s[i]);
cout<<"\n File Written.....\n";
ifstream infile("tony1.txt");
cout<<"\n Reading from file....\n";
cout<<infile.rdbuf();
cout<<endl;
cout<<"\n Reading file complete.....\n";

i hav used the following code.....

but not able to perform the options.... (a),(b),(c)...... please help........
Just search the site; there have been many, many threads on writing and reading text files. If you want the answers bad enough, just go find them...
Last edited on
You need some way of identifying a sentence. That would involve searching for '.', but you can't enter them in your program because that's the terminator for your input.

Follow the instructions. Read your input from a file. Then you can put complete sentences in the file.
Topic archived. No new replies allowed.