Count sentence's of .txt file
#include<iostream>
#include<fstream>
#include<string>
#include<cstdio>
using namespace std;
int main()
{
int line = 0;
string Word;
fstream filing;
filing.open("story.txt", ios::in);
if (!filing)
{
cout << "File
Does Not Exist" << endl;
}
else
{
cout << "File Is
Create Successfully " << endl;
while (!filing.eof())
{
getline(filing,Word,'.');
if (!filing.eof())
{
line++;
}
}
cout << endl << "Total Sentence's = " << line << endl;
}
system("pause");
}
Comments
Post a Comment