123456789101112131415161718192021222324252627282930313233
int main() { ifstream fin; ofstream fout; int integer; fout.clear(); fout.open("hi.txt"); if (!fout) { cout << " Error: file could not be opened" << endl; } while ( number != 1) { cout << number; number--; } fout.close(); fout.clear(); cin >> number; fout.open("hello.txt"); { fout << number; } fout.close(); } }