2) what data types are available
3) how do i declare?
4) how do i use
1)
#include
#include
2)
ifstream
ofstream
these are data types, just like int, double, string
3)
ifstream jin;
ofstream jout;
alternatively:
ifstream jin("hello.txt");
ofstream jout("myoutput.txt");
4)
open a file:
jin.open("hello.txt");
jout.open("myoutput.txt");
close a file:
jin.close();
jout.close();
read from a file:
int x;
jin >> x;
write to a file:
jout << x << "hello" << endl;
No comments:
Post a Comment