搜索
查看: 544|回复: 4
打印 上一主题 下一主题

完全按照书上写的,但是现实编译失败

[复制链接]
跳转到指定楼层
楼主
 楼主| 发表于 2018-10-17 20:58:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
5啊哈币
#include <stdio.h>
#include <stdlib.h>
int main()
{
     int max4(int a ,int b,int c,int d);
     int a,b,c,d,max;
     printf("pleas enter 4 number;");
     scanf("%d%d%d%d",&a,&b,&c,&d);
         max=max4(a,b,c,d);
     printf("the max = %d\n",max);
     system("pause");
         return 0;
}
  int max4(int a ,int b ,int c ,int d )
{   
   int max2(int a,int b);
   int m;
   m=max2(a,b);
   m=max2(m,c);
   m=int2(m,d);
   return(m);
}   
    int max2(int a ,int b)
{  
     if(a>=b)
       return a;
     else
       return b;

沙发
发表于 2018-10-17 22:41:30 | 只看该作者
#include <stdio.h>
#include <stdlib.h>
int main()
{
     int max4(int a ,int b,int c,int d);
     int a,b,c,d,max;
     printf("pleas enter 4 number;");
     scanf("%d%d%d%d",&a,&b,&c,&d);
         max=max4(a,b,c,d);
     printf("the max = %d\n",max);
     system("pause");
         return 0;
}
  int max4(int a ,int b ,int c ,int d )
{   
   int max2(int a,int b);
   int m;
   m=max2(a,b);
   m=max2(m,c);
   m=max2(m,d);
   return m;
}   
    int max2(int a ,int b)
{  
     if(a>=b)
       return a;
     else
       return b;}
板凳
发表于 2018-10-17 22:43:10 | 只看该作者
倒数第九行打错,倒数第八行m不需要括号,倒数第一行没加 }。
地板
发表于 2019-2-15 17:14:50 | 只看该作者
#include <stdio.h>
#include <stdlib.h>
int main()
{
      int max4(int a ,int b,int c,int d);
      int a,b,c,d,max;
      printf("pleas enter 4 number;");
      scanf("%d%d%d%d",&a,&b,&c,&d);
          max=max4(a,b,c,d);
      printf("the max = %d\n",max);
      system("pause");
          return 0;
}
   int max4(int a ,int b ,int c ,int d )
{   
    int max2(int a,int b);
    int m;
    m=max2(a,b);
    m=max2(m,c);
    m=max2(m,d);
    return m;
}   
     int max2(int a ,int b)
{  
      if(a>=b)
        return a;
      else
        return b;
}
倒数第九行打错,倒数第八行m不需要括号,倒数第一行没加 }。
5#
发表于 2019-2-16 12:31:54 | 只看该作者
int2未定义,最后打落了一个}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表