Wednesday, May 4, 2022

checking number of words in a text file

 #include<iostream>

#include<fstream>
using namespace std;
int main(){
    string word;
    int count=0;
    ifstream file;
    file.open("newfile1.txt");
    while (file>>word)
    {
        cout<<word<<endl;
    count++;
    }
    cout<<"\n words in total are "<<count<<endl;
    file.close();
    return 0;
}

No comments:

Software scope

 In software engineering, the software scope refers to the boundaries and limitations of a software project. It defines what the software wi...

Popular Posts