|
|
вернуться в форумwhy is Wrong answer? (use Visual C++ 2013) Running in my computer is OK,use use Visual C++ 2010. But in here (use Visual C++ 2013) is wrong answer. I don't understand. Help me, please! #include <iostream> using namespace std; int main(){ int a[100][100]; int n, x=0; cout<<"\Input n: "; cin>>n; for(int j=n-1,i=0;j>=0;j--){ int h=i,k=j; while(k<n) a[h++][k++]=++x; } for(int i=1,j=0;i<n;i++){ int h=i,k=j; while(h<n) a[h++][k++]=++x; } for(int i=0; i<n ;i++){ for(int j=0; j<n ;j++){ cout.width(4); cout<<a[i][j]; } cout<<endl; } cin.ignore(80,'\n'); cin.get(); return 0; } |
|
|