MENU
Question -

Write a function Countaroma() to count and display the number of times “Aroma” occurs in a text file “Cook.txt”.



Answer -

Void Countword ()
 {
 fstream tfile;
 clrscr();
 tfile.open ("Cook.txt", ios::in);
 char arr[80];
 char ch;
 int i=0;sum=0;n=0;
 while(tfile)
 {
 tfile.get (ch)
 arr[i] = ch;
 i++ ;
 if (strcpy(ch, "Aroma"))
 {
 i--;
 sum = sum+i;
 n++;
 }
 }
 Cout<<"Total number of Aroma:" <
 }

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×