how could i edit a text file f stream
Mar 23, 2014 at 10:26pm UTC
i have a assignment which sayswrite a c++ program that converts each charecter afteer a period '.' to an uppercase charecter heres what i've done and its just reading the file whithout editing
thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
int main()
{string fileName="" ;
ifstream inFile;
cout<<"please enter the file name" <<endl;
cin>>fileName;
inFile.open(fileName);
string words;
string test;
while (!inFile.eof()){
getline( inFile, words, '\0' );
inFile>>words;
for (int i=0;i<words.length();i++){
if (words[i]==(int )"." )
words[i+1]-32;
}
}
inFile.close();
ofstream outFile;
outFile.open("habal.txt" );
outFile<<words;
outFile.close();
}
Topic archived. No new replies allowed.