You are on page 1of 1

#include <cstdlib>

#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
int i,j,x;
ofstream fout;
fout.open("arquivo.txt");

for(j=0;j<5;j++){
fout<<j<<" ";
}
fout << flush;
fout.close();


ifstream fin("arquivo.txt");
if(!fin.good()){
cout<<"Este arquivo no existe!!! \n\n";
}else{
for(j=0;j<5;j++){
fin>>x;
cout<<x<<" ";
}
}

system("PAUSE");
return EXIT_SUCCESS;
}

You might also like