I have been using file io for like a week now, not an expert but this is for my computer science class.
Say the file is 71cIN.txt and inside the file it said "What a beautiful day to be programming."
And what i have to do is display all the words, and count all the letter 'e's in the sentence.
this is wat i have so far
what the problem is is that the words are all together
Output
(Whatabeautiful daytobeprogramm ing.)
how do i correct this?
and i am having trouble with the arrays (counting the 'e's)
can someone help :(
thanks
Say the file is 71cIN.txt and inside the file it said "What a beautiful day to be programming."
And what i have to do is display all the words, and count all the letter 'e's in the sentence.
this is wat i have so far
Code:
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main()
{
string sWord;
int n, arnCountE[40], nNumber;
ifstream fin;
fin.open("71cIN.txt");
while(!fin.fail())
{
fin >> sWord;
cout << sWord;
}
fin.close();
return 0;
}
Output
(Whatabeautiful daytobeprogramm ing.)
how do i correct this?
and i am having trouble with the arrays (counting the 'e's)
can someone help :(
thanks
Comment