Below is the simple c++ example program, to read contents from a text file stored in your computer's hard drive...
#include<iostream.h> #include<fstream.h> void main() { char *name; int num; ofstream fileout; fileout.open("d:\\cpp\\pgm\\a.txt"); cout<<"Enter the name"<<endl; cin>>name; cout<<"Enter number"<<endl; cin>>num; fileout<<name<<endl; fileout<<num<<endl; fileout.close(); }
Hope this helps..
Techytips
1 comments:
cplusplus code examples to beginner programmers
c++ example - Add elements in a set to a list
Post a Comment