回复 楼主 李继丙
第一个发错了,是这个,不好意思啊各位#include<stdio.h>
int li(int a[i])
{
int b;i;
for(i=0;i<100;i++)
{
if(a[i]<a[i+1])
b=a[i];
a[i]=a[i+1];
a[i+1]=b;
}
}
main()
{
int a[100],i;
printf("请输入100个数");
for(i=0;i<100;i++)
{
scanf("%d",&a[i]);
}
li(a);
for(i=0;i<100;i++)
{
printf("%d",a[i]);
}
}
F:\c语言学习\Microsoft Visual Studio\MyProjects\li\a.cpp(2) : error C2057: expected constant expression
F:\c语言学习\Microsoft Visual Studio\MyProjects\li\a.cpp(2) : error C2466: cannot allocate an array of constant size 0
F:\c语言学习\Microsoft Visual Studio\MyProjects\li\a.cpp(21) : error C2018: unknown character '0xa3'
F:\c语言学习\Microsoft Visual Studio\MyProjects\li\a.cpp(21) : error C2018: unknown character '0xbb'
F:\c语言学习\Microsoft Visual Studio\MyProjects\li\a.cpp(22) : error C2143: syntax error : missing ';' before 'for'
F:\c语言学习\Microsoft Visual Studio\MyProjects\li\a.cpp(26) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
麻烦大家了,不好意思啊