Skip to main content

Posts

Featured

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"<...

Latest Posts

How to create foreign key in Mysql

C++ program to reverse individual words

C++ program to display numbers which get reversed after multiplying by 4

C++ program to count vowels and consonants in text file

C++ Program to find sum of digits of a decimal number

Prime Factors Program in C++

If Else Switch Case in C++ Programming

Data Types And Operators in C++ Programming