当前位置: 代码迷 >> C语言 >> 看看我的数组数据。谢谢!
  详细解决方案

看看我的数组数据。谢谢!

热度:166   发布时间:2007-08-25 11:07:35.0
看看我的数组数据。谢谢!
下面是我写的程序,为什么我输出的数组数据全都是0,没有保存到吗?求助!!!
#include "stdio.h"
main()
{int n,w,m,i,k;int score[40][3];
printf("welcome!!,printf input the data necessary.\n");
printf("input the number of schools\n n=");
scanf("%d",&n);
printf("\ninput the number of girl items\n w=");
scanf("%d",&w);
printf("\ninput the number of boy items\n m=");
scanf("%d",&m);

for(i=1;i<=m+w;i++)
for(k=1;k<=3;k++)
{printf("please input the NO.%d item,the number of rank %d school\nscore[%d-1][%d-1]=",i,k,i,k);
scanf("%d",score[i-1][k-1]);
}

for(k=0;k<3;k++)
{for(i=0;i<m+w;i++)
printf("%d ",score[i][k]);
printf("\n");
}
}
搜索更多相关的解决方案: 数据  

----------------解决方案--------------------------------------------------------

#include "stdio.h"
main()
{int n,w,m,i,k;int score[40][3];
printf("welcome!!,printf input the data necessary.\n");
printf("input the number of schools\n n=");
scanf("%d",&n);
printf("\ninput the number of girl items\n w=");
scanf("%d",&w);
printf("\ninput the number of boy items\n m=");
scanf("%d",&m);

for(i=1;i<=m+w;i++)
for(k=1;k<=3;k++)
{printf("please input the NO.%d item,the number of rank %d school\nscore[%d-1][%d-1]=",i,k,i,k);
scanf("%d",&score[i-1][k-1]); //这里要取地址
}

for(k=0;k<3;k++)
{for(i=0;i<m+w;i++)
printf("%d ",score[i][k]);
printf("\n");
}
}


----------------解决方案--------------------------------------------------------

#include "stdio.h"
main()
{int n,w,m,i,k;int score[40][3];
printf("welcome!!,printf input the data necessary.\n");
printf("input the number of schools\n n=");
scanf("%d",&n);
printf("\ninput the number of girl items\n w=");
scanf("%d",&w);
printf("\ninput the number of boy items\n m=");
scanf("%d",&m);

for(i=1;i<=m+w;i++)
for(k=1;k<=3;k++)
{printf("please input the NO.%d item,the number of rank %d school\nscore[%d-1][%d-1]=",i,k,i,k);
scanf("%d",&score[i-1][k-1]);//魔城侠客对~
}

for(i=0;i<m+w;i++)
{for(k=0;k<3;k++)//这样稍稍规范一点。
printf("%d ",score[i][k]);
printf("\n");
}
}


----------------解决方案--------------------------------------------------------
那个无所谓规范不规范,是输出顺序的问题



by 雨中飞燕 QQ:78803110 QQ讨论群:5305909

请大家不要用TC来学习C语言
C/C++算法习题(OnlineJudge):[url]http://yzfy.org/[/url]
----------------解决方案--------------------------------------------------------
  相关解决方案