-
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.......
-
So, what is your code for reading and writing the data?
-
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.....