twitter

Hello my friend. How are you today. I hope you are is fine. In this time I want give you a simple program about input and output file. And this is the program :

#include
#include //its use to call input and output function.

//for input file:

int main(){
int x;
ofstream fileout;
fileout.open("myfile.txt");
cout<<" The program for printing a numbers in 5 times :"; 

for(int i=0; i<5;i++){ 
cout<<" Data on - "<<x+1;
fileout<<x<<endl;

}
fileout.close();
getch();
return 0; }


this program use to save data on computer. And can call program with this program :

#include
#include //its use to call input and output function.

//for input file:

int main(){
int x;
ifstream fileon;
fileoin.open("myfile.txt");
int x[5];
cout<<" The program for printing a numbers in 5 times :";
for(int i=0; i<5;i++){
filein>>x[i];
cout<<" Data on - "<<x+1<<"\t"<<x[i]<,endl;
}
filein.close();

getch();
return 0;
}

you can try this program that undestand it. Thank you to read my blog.
Good Luck..


Minggu, 03 April 2011 | 0 komentar | Label: ,