Showing posts with label no of words in txt file. Show all posts
Showing posts with label no of words in txt file. Show all posts

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;
}

HackCache ’26: A 48-Hour Online Hackathon Open to Every Student

  Hackathons are often associated with computer science students, experienced developers, and teams that already know exactly what they are...

Popular Posts