资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

在线等!!请教

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

1。  
  //*****************************************  
  //**                             ch1_3.1.cpp                         **  
  //*****************************************  
   
  #include<iostream.h>  
  #include<math.h>  
   
  double   max(double   x,double   y,double   z);  
   
  void   main()  
  {  
        double   a,b,c,d;  
        cout<<"input   three   numbers:\n";  
        cin>>a>>b>>c;  
           
        d=max(a,b,c);  
        cout<<"the   squart   of   maximum="<<sqrt(d)<<endl;  
  }  
   
   
  double   max(double   x,double   y,double   z)  
  {    
        if(x>y)    
            return   x;  
            if(y>z)  
                return   y;  
        else  
            return   z;  
  }    
   
  2。  
  //*******************************************  
  //**                             ch1_3.1.1.cpp                         **  
  //*******************************************  
   
  #include<iostream.h>  
  #include<math.h>  
   
  double   max(double   x,double   y,double   z);  
  {    
        if(x>y)    
            return   x;  
            if(y>z)  
                return   y;  
        else  
            return   z;  
  }  
         
  void   main()  
  {  
        double   a,b,c,d;  
        cout<<"input   three   numbers:\n";  
        cin>>a>>b>>c;  
           
        d=max(a,b,c);  
        cout<<"the   squart   of   maximum="<<sqrt(d)<<endl;  
  }  
   
  &#8226;Compiling   NONAME04.CPP:  
    Error   NONAME04.CPP   11:   Declaration   terminated   incorrectly  
   
  第一个程序可以通过,怎么第二个不可以通过呢;我用if语句对吗?谢谢:

网友回答:

发表者:ftkghost

double   max(double   x,double   y,double   z);         //这行后面的分号去掉  
  {    
        if(x>y)    
            return   x;  
            if(y>z)  
                return   y;  
        else  
            return   z;  
  }  
 

发表者:o1n

#include<iostream.h>  
  #include<math.h>  
   
  double   max(double   x,double   y,double   z)//原程序这里  
  {    
        if(x>y)    
            return   x;  
            if(y>z)  
                return   y;  
        else  
            return   z;  
  }  
         
  void   main()  
  {  
        double   a,b,c,d;  
        cout<<"input   three   numbers:\n";  
        cin>>a>>b>>c;  
           
        d=max(a,b,c);  
        cout<<"the   squart   of   maximum="<<sqrt(d)<<endl;  
  }

发表者:wanglianhui

double   max(double   x,double   y,double   z);  
  这行多了;这个吧,   这是定义和声明一起的呀!!

发表者:longki

 
      定义和声明一起也不是这样吧!应当是:  
      double   max(double   x,double   y,double   z);  
      double   max(double   x,double   y,double   z)  
      {    
        if(x>y)    
            return   x;  
            if(y>z)  
                return   y;  
        else  
            return   z;  
      }

发表者:kenyle

原因就是他们说的多了一个;号.

发表者:kobefly

如果是n多数  
  在一个数组里  
  那你就遍历一下  
  然后排序就可以了  
  qsort()


 

 
热门推荐笔记本: 华硕笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved