vc
写
c程序不用加
什么特殊的头文件!!直接用就是了
clrscr(),getch()函数等
必须调用stdlib.h
conio.h
main()
{int
a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}
int
max(int
x,int
y)
/*定义max函数*/
{int
z;
if(x>y)
z=x;
else
z=y;
return(z);
}
********以上这个程序,只要在main()函数上面加个int
max(int
x,int
y)
;
就可以了
更改后的完整程序是这样的:
#include
"stdio.h"
int
max(int
x,int
y);
//预定义函数
main()
{int
a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d",c);
}
int
max(int
x,int
y)
/*定义max函数*/
{int
z;
if(x>y)
z=x;
else
z=y;
return(z);
}
我是第一个回答的!!!加分啊
*******************************************
*************按你要求,补充回答************
*******************************************
程序更改如下:
#include
"stdio.h"
#include
"conio.h"
#include
"stdlib.h"
main()
{
int
a,b,c;
system("cls")
;
//
clrscr();
puts("输入两个整数:");
scanf("%d,%d",&a,&b);
c=a+b;
system("cls")
;
//clrscr();
printf("%d+%d=%d\n\n\n",a,b,c);
puts("按任意键继续");
getch();
c=a*b;
system("cls")
;
//clrscr();
printf("%d*%d=%d\n",a,b,c);
}
clrscr和getch不在stdio.h这个头文件中,需要再多引入一个conio.h头文件,不过在VC中可能没有clrscr这个函数,即使有也不会执行出什么效果,这个函数只有在DOS下才能用,Windows下的控制台模式这个函数是不起作用的
问题补充:
getch()
在
conio.h
头文件
中
VC中没有clrscr()这个函数,此函数只在TC中有,这个是清屏函数,
你可以用
中的
system("cls")
故综上
在你的程序中要加上
#include
#include
.....
下面的清屏函数改为
system("cls")