Tuesday, 17 October 2017

How to write a function count to count the blank spaces present in a file notes.txt in C++.


In this blog we will see how to write a function count to count the blank spaces present in a file notes.txt in C++ , you can do so by following the given steps below.

Step 1: Go to your C++ compiler and type the given programme below.



 void countblankspaces()
 {
 ifstream fin;
 fin.open("notes.txt",ios::n);
 char ch; int count;
 while(!fin.eof())
 {fin.get(ch);
 if(ch=="")
 count++;
 }
 fin.close();
 count<<count;
 }


Step 2: Compile(alt+c) your programme and run(alt+r).
Share:
Categories

0 comments:

Post a Comment