| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 824 人关注过本帖
标题:照书上敲的......结果...
只看楼主 加入收藏
浅水无殇
Rank: 2
等 级:论坛游民
帖 子:123
专家分:75
注 册:2012-11-23
结帖率:100%
收藏
 问题点数:0 回复次数:6 
照书上敲的......结果...
#include<iostream>
using namespace std;
template <typename T>;
T max(T a,T b,T c)
{
    if(b>a) a=b;
if(c>a) a=c;
return a;

}
int main()
{int i1=8,i2=5,i3=6,i;
double d1=56.9,d2=90.765,d3=43.1,d;
long g1=678984,g2=-1245,g3=-45461,g;
i=max(i1,i2,i3);
d=max(d1,d2,d3);
g=max(g1,g2,g3);
cout << "i_max="<<i<<endl;
cout <<"f_max="<<f<<endl;
cout <<"g_max=""<<G<<endl;


    return 0;
}
C:\Documents and Settings\4-2\xxm.cpp(4) : error C2059: syntax error : '<end Parse>'
C:\Documents and Settings\4-2\xxm.cpp(7) : error C2143: syntax error : missing ';' before '{'
C:\Documents and Settings\4-2\xxm.cpp(7) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\4-2\xxm.cpp(16) : error C2065: 'i' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(16) : error C2065: 'max' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(17) : error C2065: 'd' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(18) : error C2065: 'g' : undeclared identifier
C:\Documents and Settings\4-2\xxm.cpp(19) : fatal error C1903: unable to recover from previous error(s); stopping compilation
Error executing cl.exe.

xxm.obj - 8 error(s), 0 warning(s)

搜索更多相关主题的帖子: max Documents include double 
2013-03-13 15:10
浅水无殇
Rank: 2
等 级:论坛游民
帖 子:123
专家分:75
注 册:2012-11-23
收藏
得分:0 
cout <<"g_max=""<<G<<endl;

.....抱歉....

wula wual
2013-03-13 15:13
starlee1987
Rank: 2
等 级:论坛游民
帖 子:3
专家分:20
注 册:2013-3-15
收藏
得分:0 
哥,你有多马虎啊?
程序代码:
#include<iostream>

 using namespace std;

 template <typename T>

 T max(T a,T b,T c)

 {
     if(b>a) a=b;

 if(c>a) a=c;

 return a;

}

 int main()

 {int i1=8,i2=5,i3=6,i;

 double d1=56.9,d2=90.765,d3=43.1,d;

 long g1=678984,g2=-1245,g3=-45461,g;

 i=max(i1,i2,i3);

 d=max(d1,d2,d3);

 g=max(g1,g2,g3);

 cout << "i_max="<<i<<endl;

 cout <<"d_max="<<d<<endl;

 cout <<"g_max="<<g<<endl;


    return 0;

 }
2013-03-15 23:19
一路看天
Rank: 1
来 自:广西
等 级:新手上路
帖 子:12
专家分:4
注 册:2012-11-26
收藏
得分:0 
目的是什么?
2013-03-18 22:36
逆风而前
Rank: 7Rank: 7Rank: 7
来 自:福建
等 级:黑侠
威 望:7
帖 子:193
专家分:567
注 册:2013-2-14
收藏
得分:0 
3楼正解
2013-03-20 09:53
犹豫情人
Rank: 2
来 自:天津
等 级:论坛游民
帖 子:58
专家分:24
注 册:2010-7-1
收藏
得分:0 
求三个数里面最大的数是吧。
2013-03-21 22:55
VB丶小宇
Rank: 3Rank: 3
来 自:河北省石家庄市
等 级:论坛游侠
帖 子:172
专家分:142
注 册:2013-3-11
收藏
得分:0 
3楼正解。

编程最蛋疼的事:不是编程多么累,而是编完后,一点运行,出现四个字:程序错误。。。
2013-03-22 11:16
快速回复:照书上敲的......结果...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022054 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved