急啊 c++谁会速来 题目:设计一个三角型类triangle 数据成员为三边长 重载运算符+为

[复制链接]
查看11 | 回复2 | 2012-6-11 23:21:07 | 显示全部楼层 |阅读模式
#include using namespace std;class triangle; //提前声明ostream& operator<<(ostream& out, triangle& ot);class triangle{double e1,e2,e3;public:triangle(double a=3,double b=4,double c=5)//构造函数{if(a+b<=c || a+c<=b || b+c<=a){cout <<"Error!\n";exit(1);}e1=a; e2=b; e3=c;}t...
回复

使用道具 举报

千问 | 2012-6-11 23:21:07 | 显示全部楼层
//绝对满分#includeusing namespace std;class Triangle {public:int a, b, c;Triangle(int a = 0, int b = 0, int c = 0) :a(a), b(b), c(c) {}};Triangle operator+(Triangle& t1, Tr...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行