ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1313. Some Words about Sport

Compilation Error???
Posted by logicerror 27 Feb 2005 20:38
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