24小时热门版块排行榜    

查看: 278  |  回复: 1

冰雨hust

铁虫 (小有名气)

[求助] c++问题

#include
using namespace std;
template
class Compare
{public:
Compare(numtype a,numtype b)
{x=a;y=b;}

numtype max()
{return (x>y)?x:y

numtype min()
{return (x


private:
numtype x,y;
};

int main()
{
Compare comp1(4,6);
cout< cout<
Compare comp2(2.3,7.8);
cout< cout<
Compare comp3('w','u');
cout< cout<
return 0;
}
为什么在编译时总是说我最后一行那个‘}’出了问题,费解,请教各位大神~~~
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

libralibra

至尊木虫 (著名写手)

骠骑将军

【答案】应助回帖

★ ★
感谢参与,应助指数 +1
冰雨hust: 金币+2, ★★★★★最佳答案 2013-03-03 12:12:13
花括号要匹配,否则就会有问题,调试通过的代码
CODE:
#include
using namespace std;
template
class Compare
{
public:
    Compare(numtype a,numtype b) {x=a;y=b;}

numtype max() {return (x>y)?x:y; }

numtype min() {return (x
private:
    numtype x,y;
};

int main()
{
    Compare comp1(4,6);
    cout<     cout<
    Compare comp2(2.3,7.8);
    cout<     cout<
    Compare comp3('w','u');
    cout<     cout<
    return 0;
}

matlab/VB/python/c++/Java写程序请发QQ邮件:790404545@qq.com
2楼2013-03-01 20:49:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 冰雨hust 的主题更新
信息提示
请填处理意见