www.ypnh.net > C++ 编程,三角形类

C++ 编程,三角形类

#include using namespace std;int main(){int s1,s2,s3;couts2>>s3;if((s1+s2

#include #include using namespace std; class Ctriangle { public: void get_value(); double area(); float circumference(); void display1(); void display2(); public: double l1; double l2; double l3; double s; }; void Ctriangle::g...

不考虑输入数为负的情况。程序如下: #include #include main() { float a,b,c,s,v; printf("input 1,2,3 or 4,4,4 or 2,8,8 or 5,2,9\n"); scanf("%f,%f,%f",&a,&b,&c); s=(a+b+c)/2.0; v = s * (s-a) * (s-b) * (s-c); if (v==0) printf("Yes,...

VC6可以通过,你试试: #include #include double trianglearea(double x,double y,double z) { double temp,area; temp=(x+y+z)/2; area=sqrt(temp*(temp-x)*(temp-y)*(temp-z)); return area; } void main() { double a,b,c,area=0; couta>>b>>c...

你的代码问题不大,有些笔误。公式的话好像也有些小错误,结合网上搜的,做了下修改,你看下对不对: #include #include using namespace std;class Point{int x, y;public:Point(int = 0, int = 0);Point(Point &);void display(){ cout

#include #include using namespace std; class point { private:float x,y; public:point(float a,float b){x=a;y=b;} point(){x=0;y=0;} void set(float a,float b){x=a;y=b;} float getx(){return x;} float gety(){return y;} }; class tri{...

#include using namespace std; class triangle{ private: double a; double b; double c; public: triangle(double a1=1,double b1=1,double c1=1) { a=a1;b=b1;c=c1; } double Area() { double s=(a+b+c)/2; return sqrt(s*(s-a)*(s-b)*(s-c))...

#include using namespace std;int main(){ double a, b, c; cin >> a >> b >> c; if (a

#include #include // 判断(x, y), (xx, yy)是否在由(x1, y1)和(x2, y2)组成的直线的同一侧bool on_the_same_side( int const x, int const y, int const xx, int const yy, int const x1, int const y1, int const x2, int const y2 ) { int co...

你好! 既然是C++,就用C++代码吧,可以用到面向对象的设计思维。我帮你写了个程序,没错误没警告,还可以重复输出的: #include "iostream" using namespace std; class Trigon { public: Trigon(){}; ~Trigon(){}; PrintTrigon() { coutnum; f...

网站地图

All rights reserved Powered by www.ypnh.net

copyright ©right 2010-2021。
www.ypnh.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com