|
|
back to boardCompilation Error??? Why? here's my code: #include <iostream> #include <stdlib.h> #include <fstream> using namespace std; int main(int argc, char *argv[]) { int n; ifstream file; file.open("input.txt", ios::in); file >> n; int arr[n+1][n+1]; int result[n*n]; for (int j=1; j<=n; j++) for (int i=1; i<=n; i++) file >> arr[i][j]; file.close(); int start_x=1,end_x=1,x=0,y=2; int start_y=1,end_y=1; ofstream ofile; ofile.open("output.txt", ios::out); for (int i=1; i<=n*n; i++) { x++; if (x > end_x) { x=start_x; end_x++; } if (end_x > n) { end_x=n; start_x++; x=start_x; } y--; if (y < end_y) { y=++start_y; } if (start_y > n) { y=start_y=n; end_y++; }
ofile << arr[x][y] << " "; } ofile.close(); system("PAUSE"); return 0; } please tell me what's the problem... Why you deal with files? (+) Posted by Heaven 27 Feb 2005 20:52 Use standart i/o stream. Do not use system function |
|
|