how to read integers from file and write each integer into different name integer?
Posted
by Aivaras
on Stack Overflow
See other posts from Stack Overflow
or by Aivaras
Published on 2010-04-26T18:01:27Z
Indexed on
2010/04/26
18:03 UTC
Read the original article
Hit count: 238
This is how the program looks and i need to make all integers with different name. Like x,x1,x2 and so on...
#include <cstdlib>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream iFile("input.txt"); // input.txt has integers, one per line
while (true) {
int x;
iFile >> x;
if( iFile.eof() ) break;
cerr << x << endl;
}
system("Pause");
return 0;
}
© Stack Overflow or respective owner