File Handling
3
Write a c++ program to read some characters from a file and display the no of b’s used. #include<iostream.h> #include<conio.h> #include<fstream.h> void main() { clrscr(); int i,c=0; char a[30]; ifstream fin("New.txt",ios::in); fin.getline(a,30,'\n'); for(i=0;a[i]!=NULL;i++) { if(a[i]=='b') c++; } cout<<"the no of b's are"<<c; }
-
Upload
arnab-chakrabarti -
Category
Documents
-
view
218 -
download
0
description
FILE
Transcript of File Handling
Write a c++ program to read some characters from a file and display the no of bs used.
#include#include#includevoid main(){clrscr();int i,c=0;char a[30];ifstream fin("New.txt",ios::in);fin.getline(a,30,'\n');for(i=0;a[i]!=NULL;i++){if(a[i]=='b')c++;}cout