C++ ofstream Writes the numbers from 1 to 100 to a file
#include <fstream.h> ofstream fp;//from w ww . j a v a 2 s .c om void main() { int ctr; fp.open("NUMS.1", ios::out); // Creates a new file. if (!fp) { cout << "Error opening file.\n"; } else { for (ctr = 1; ctr < 101; ctr++) { fp << ctr << " "; } } fp.close(); return; }