Program for Output or Capture Data from Files
# include <cstdlib>
# include <iostream>
# include <fstream.h>
using namespace std;
int main (int argc, char * argv [])
{
ifstream open;
buka.open ("nilai.txt");
int value [5];
court <<"Input value \ n";
for (int i = 0; i <5; i + +)
{
go>> value [i];
court <<"Numbers to [" <<i +1 <<"]:"<< value [i] <<endl;
}
buka.close ();
system ("PAUSE");
return EXIT_SUCCESS;
}
Explanation:
Statement row - 10 declare open a variable of type ifstream (input file). This variable is used to read data from file (line 16) replace cin is usually entered via the keyboard.
Leave reply