#include #include using namespace std; int main() { ofstream outf("temp.dat"); //open for output temp.dat if (! outf) { //can replace with exception handling cerr << "could not open temp.dat\n"; return -1; } for(int i = 0; i < 100; ++i){ if (i % 10 == 0) outf <<'\n'; //newline every 10 values outf << rand() << '\t'; //tab } outf << endl; //newline + advance }