//Assuming ini.txt and input.dat both contain integer data. The 2 while //loops each read data until the end of file is encountered (assuming all //data in the file(s) is integer data. #include #include using namespace std; int main() { ifstream infile1, infile2; int x; infile1.open("ini.txt"); while(!infile1.eof()) { cout << "in while" << endl; infile1>>x; cout << x; } infile2.open("input.dat"); while (infile2 >> x) cout << x; infile1.close(); infile2.close(); }