1.

Write a function in C++ to count the number of digits present in a text file “PARA.TXT”. 

Answer»

void countdigit()  {

ifstream fil("PARA.TXT”,ios::in);

int count=0;

char ch=fil.get();

while(!fil.eof())

{  if(isdigit(ch))

count++;

ch=fil.get();

}

cout<<"no of digit: "<<count<<end1;

}



Discussion

No Comment Found

Related InterviewSolutions