#include<stdio.h>
main()
{
int a;
printf("请输入一个整数:");
scanf("%d",a);
if(a>0);
{
printf("%d\n",a);
}
else
{
printf("%d\n",-a);
}
}
Compiling...
二class1.cpp
C:\Users\adm\Desktop\c语言学习\二class1.cpp(8) : warning C4390: ';' : empty controlled statement found; is this the intent?
C:\Users\adm\Desktop\c语言学习\二class1.cpp(11) : error C2181: illegal else without matching if
C:\Users\adm\Desktop\c语言学习\二class1.cpp(15) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
二class1.obj - 1 error(s), 0 warning(s)