Counting digit alpha and other characters in input file

I have code to open and display an input text file in the console but need to count the characters (digit and alpha) and dont know how to go about doing it. Input file "data.txt" reads
Bob 90 92 85
Mary 65 100
Joe 87
i hope someone can help with my problem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  
#include <iostream>
using namespace std;
#include <fstream>
int main()
{
       char c;
       string s;
       ifstream input("data.txt");
       if(!input)cout<<"error";//make sure file opened
       ofstream output("out.txt");
      
       while(!input.eof()){
 
       c=input.get();
       cout<<c;
      
}
output.close();
       return 0;
}
Last edited on
Topic archived. No new replies allowed.