完成C++第9章的作业
发布时间
阅读量:
阅读量
文章结构概述
- 三角形类别
- 学生分数类别
- 电视机类别
三角形类
问题描述
#include<iostream>
#include<cmath>
#include<iomanip>
class Beeline{
private:
int x1;
int x2;
int y1;
int y2;
public:
Beeline(int xx1=0,int yy1=0,int xx2=0,int yy2=0):x1(xx1),y1(yy1),x2(xx2),y2(yy2){};
float length();
void show();
};
float Beeline::length()
{
return (sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
}
void Beeline::show()
{
std::cout << "(" << x1 << ", " << y1 << "),(" << x2 <<", " << y2 <<")" << std::endl;
}
全部评论 (0)
还没有任何评论哟~
