Program to display 3 character words in C++ Text File
//Program to count 3 character words in C++ Text File #include<fstream.h> #include<conio.h> #include<stdlib.h> #include<string.h> void ADDDATA() { fstream f; f.open("STORY.TXT",ios::out); f<<"The Tajmahal is famous for its grandeur. The Taj is also famous for its marble."; f.close(); } void DISP3CHAR() { fstream f; f.open("STORY.TXT",ios::in); char word[30]; f>>word; while(f) { if(strlen(word)==3) cout<<word<<"\t"; f>>word; } f.close(); } void main() { int ch; char ans; do { clrscr(); cout<<"1.ADD DATA in FILE\n"; cout<<"2 Display 3 Letter Words in FILE\n"; cout<<"3.EXIT\n"; cout<<"\nEnter Your Choice\n"; cin>>ch; if(ch==1) { ADDDATA(); } if(ch==2) { DISP3CHAR(); } if(ch==3) { exit(0); } cout<<"Wanna See Menu Again Y/N"<...