|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码:
- #include<stdio.h>
- #define N 100
- #include<stdlib.h>
- #include<time.h>
- int main()
- {
- srand((unsigned)time(NULL));
- int a[N];
- int i,j,t;
- printf("排序前的随机数为:\n");
- for(i=0;i<=9;i++){
- a[i]=rand()%31+70;
- printf("%d\t",a[i]);
- }
- putchar('\n');
- printf("排序后为:\n");
- for(i=0;i<=9;i++){
- for(j=i+1;j<=9;j++)
- if(a[i]<a[j]){
- t=a[i];
- a[i]=a[j];
- a[j]=t;}
- printf("%d\t",a[i]);
- }
- putchar('\n');
- return 0;
- }
复制代码
错误信息:
Compiling...
wenda.c
D:\VC6.0\CCC\wenda.c(8) : error C2143: syntax error : missing ';' before 'type'
D:\VC6.0\CCC\wenda.c(9) : error C2143: syntax error : missing ';' before 'type'
D:\VC6.0\CCC\wenda.c(11) : error C2065: 'i' : undeclared identifier
D:\VC6.0\CCC\wenda.c(12) : error C2065: 'a' : undeclared identifier
D:\VC6.0\CCC\wenda.c(12) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(12) : error C2106: '=' : left operand must be l-value
D:\VC6.0\CCC\wenda.c(13) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(18) : error C2065: 'j' : undeclared identifier
D:\VC6.0\CCC\wenda.c(19) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(19) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(20) : error C2065: 't' : undeclared identifier
D:\VC6.0\CCC\wenda.c(20) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(21) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(21) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(21) : error C2106: '=' : left operand must be l-value
D:\VC6.0\CCC\wenda.c(22) : error C2109: subscript requires array or pointer type
D:\VC6.0\CCC\wenda.c(22) : error C2106: '=' : left operand must be l-value
D:\VC6.0\CCC\wenda.c(23) : error C2109: subscript requires array or pointer type
执行 cl.exe 时出错.
wenda.obj - 1 error(s), 0 warning(s)
|
|