Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program that reads a file first.txt and creates a new file second.txt containing all words from file first.txt which start with an upper-case alphabet.
- /*first.txt:-
- The C++ is a the general purpose the programmingthe language.
- An appple a day keeps the doctor away.
- History repeats itself.
- All that glitters is not gold.
- If life deals you lemons, make lemonade.
- */
- #include<iostream.h>
- #include<conio.h>
- #include<fstream.h>
- #include<ctype.h>
- void main()
- {
- clrscr();
- char a[80];
- ifstream ifile("first.txt");
- ofstream ofile("second.txt");
- while(!ifile.eof())
- {
- ifile>>a;
- if(isupper(a[0]))
- ofile<<a;
- }
- char b;
- ifstream ifile2;
- ifile2.open("second.txt");
- while(!ifile2.eof())
- {
- ifile2.get(b);
- cout<<b;
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement