帮忙找下错

来源:百度知道 编辑:UC知道 时间:2024/05/30 05:13:30
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
void main()
{
int b[10],i,j,c;
srand((unsigned)time(NULL));
for(i=0;i<10;i++);
{
b[i]=rand()%101;
printf("b[%d]=%d\n",i,b[i]);
}
c=b[0];
for(j=1;j<10;j++)
{
if(c<b[i])
{
c=b[i];
}
}
printf("%d\n",c);

} 出来对话框 B的问题

#include "stdio.h"
#include "stdlib.h"
#include "time.h"
void main()
{
int b[10],i,j,c;
srand((unsigned)time(NULL));
for(i=0;i<10;i++)//分号去掉
{
b[i]=rand()%101;
printf("b[%d]=%d\n",i,b[i]);
}
c=b[0];
for(j=1;j<10;j++)
{
if(c<b[j]) //这里应该是j吧。i=10是要出错的
{
c=b[j];
}
}
printf("%d\n",c);
system("pause");
}