回 帖 发 新 帖 刷新版面

主题:[讨论]入门菜鸟的程序,有没有哪里有语法错误?

main()
{int a,b,c;                                  
scanf("%d,%d",&a,&b);                        
c=max(a,b);                                 
printf("max=%d",c);                         

max(x,y)                                     
{int x,y;                                    
if (x>y) z=x;                              
else z=y;
return (z)                                   
}                                             

[fly]我爱C程序!~!~!~[/fly]

回复列表 (共5个回复)

沙发

我是13岁小朋友(我不是这个号的本人,不要误会),还什么都不懂!有心人看看有什么语法错误,谢谢!

板凳


}   shao le yi ge

3 楼

#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)    
{
   return x>y?x:y;                               
}

4 楼

楼主程序错在没定义Z

楼上程序不错

5 楼

谢谢哈!这是经修改的程序:
main()
{int a,b,c;                                  
scanf("%d,%d",&a,&b);                        
c=max(a,b);                                 
printf("max=%d",c); 
}                        

int max(x,y)                                     
int x,y;                                    
{int z;
if (x>y) z=x;                              
else z=y;
return (z);                                   
}

我来回复

您尚未登录,请登录后再回复。点此登录或注册