注册 登录
编程论坛 VC++/MFC

求大大鉴定下程序

trflty 发布于 2012-02-09 20:24, 535 次点击
int max(int a,int b); /*函数说明*/
main() /*主函数*/
{
int x,y,z; /*变量说明*/
int max(int a,int b); /*函数说明*/
printf("input two numbers:\n");
scanf("%d%d",&x,&y); /*输入x,y值*/
z=max(x,y); /*调用max函数*/
printf("maxmum=%d",z); /*输出*/
}
int max(int a,int b) /*定义max函数*/
{
if(a>b)return a;else return b; /*把结果返回主调函数*/
}
vc6上有报错有一个,大大们鉴别下
6 回复
#2
红色警戒2012-02-10 11:48
你把错误信息发上来
#3
xingzhian2012-02-10 14:27
是这个错误:error C4430: missing type specifier - int assumed. Note: C++ does not support default-int  ????
这个编译器的原因,因为有一些编译器main函数没有默认返回:

void main() 这样试试。
#4
starfare2012-02-10 14:31
int max(int a,int b)这个函数中增加一个变量  然后将两个数值比较 最终结果存在第3个变量当中去 然后再return
你现在return 根本就不能成立 仔细看下函数体的定义  不能那样用return
#5
ggliudan2012-02-19 10:53
无语
#6
郭光华2012-02-19 12:27
q.exe - 0 error(s), 0 warning(s)

是正确的啊

 
 
#7
郭光华2012-02-19 12:28
#include<iostream>
1