Computer Science, asked by sidhar26, 1 year ago

write a C++ program which reads the contents of a text file " first-file text"

Answers

Answered by Yagami
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();
}

Similar questions