#include
int main ()
{int a,b,max;
printf ("\n输入2个数a b:");
scanf ("%d%d",&a,&b);
if (a>b) max=a;
else max=b;
printf("\n%d %d的最大值为%d",a,b,max);
system("pause");
}
为什么在compile的时候显示system was not declared in this scope
因为system是一个库所含有的,我们导入stdlib.h就可以了
#include <stdio.h>
#include<stdlib.h>
int main ()
{int a,b,max;
printf ("\n输入2个数a b:");
scanf ("%d%d",&a,&b);
if (a>b) max=a;
else max=b;
printf("\n%d %d的最大值为%d",a,b,max);
system("pause");
}
使用system要加个头部引入
#include <stdio.h>
#include <cstdlib>
int main ()
{int a,b,max;
printf ("\n输入2个数a b:");
scanf ("%d%d",&a,&b);
if (a>b) max=a;
else max=b;
printf("\n%d %d的最大值为%d",a,b,max);
system("pause");
}
需要声明一下