write a C++ program which reads the contents of a text file " first-file text"
Answers
Answered by
1
#include<fstream.h>
void main()
{
ifstream fin;
fin.open("filename.txt";ios::in);
char ch[20];
int count=0;
while(!fin.eof())
{
fin.get(ch);
if(strcmp(ch,"first-file text)==0)
count++;
}
fin.close();
}
void main()
{
ifstream fin;
fin.open("filename.txt";ios::in);
char ch[20];
int count=0;
while(!fin.eof())
{
fin.get(ch);
if(strcmp(ch,"first-file text)==0)
count++;
}
fin.close();
}
Similar questions