Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我是C++的初学者,请问一下这道题目应该怎么输入?为什么我这样的输入有问题?#include<iostream.h> int main() { const maxn = 10, maxm = 6; char a[maxn,maxm]; int b[maxm],c[maxm]; int n,m; while (cin>>n>>m); { int i,j,k; for (i = 1; i <= m; i++) { for (j = 1; j <= n; j++) cin>>a[i,j]; //这一句运行下来总归有问题~ } for (i = 1; i <= m; i++) for (j = 1; j < n; j++) if (a[i,j] > a[i,j + 1]) b[i]+=int(a[i,j]) - int(a[i,j + 1]); for (i = 1; i < m; i++) for (j = i + 1; j <= m; j++) if (b[i] > b[j]) { for (k = 1; k <= n; k++) c[k] = a[i,k]; for (k = 1; k <= n; k++) a[i,k] = a[j,k]; for (k = 1; k <= n; k++) a[j,k] = c[k]; } for (i = 1; i <= m; i++) { for (j = 1; j <= n; j++) cout<<a[i,j]; cout<<endl; } } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator