Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- int main()
- {
- using namespace std;
- string filename;
- cout<<"Enter name for new file:";
- cin>>filename;
- ofstream fout(filename.c_str());
- fout<<"For your eyes only!n";
- cout<<"Enter you secret number";
- float secret;
- cin>>secret;
- fout<<"Your secret number is"<<secret<<endl;
- fout.close();
- ifstream fin(filename.c_str());
- cout<<"Here are the contents of"<<filename<<":n";
- char ch;
- while(fin.get(ch))
- cout<<ch;
- cout<<"Donen";
- fin.close();
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement