C shape 是什么

C shape 是什么,第1张

不是C shape

是C#(C Sharp)是微软(Microsoft)为.NET Framework量身订做的程序语言,C#拥有C/C++的强大功能以及Visual Basic简易使用的特性,是第一个组件导向(Component-oriented)的程序语言,和C++与Java一样亦为对象导向(object-oriented)程序语言。

http://baike.baidu.com/view/107979.htm?fr=ala0_1

这种问题截图更好一点。无法打开文件包含,可能有几种情况。

1 名字写错了,仔细检查

2 文件位置问题,默认路径是你的工程源文件所在文件加。如果你没有设置过,去那里看看文件是不是真的在。

#include <iostream>

#include <math.h>

using namespace std

#define PI 3.14

enum Colors{

Black,

White,

Orange,

Blue // etc...

}

class Shape{

public:

inline int Color() const

{return color}

void SetColor(int color)

{this->color = color}

virtual double Area() const=0

private:

int color

}

class Point{

public:

Point(double a, double b):x(a),y(b){}

double x

double y

}

class Rectangle : public Shape{

public:

Rectangle(double x, double y, double w, double h):

tl(x,y),br(x+w,y+h)

{

}

double Area() const

{return abs((tl.x - br.x)*(tl.y - br.y))}

private:

Point tl

Point br

}

class Circle: public Shape{

public:

Circle(double x, double y, double r):c(x,y){

this->r=r

}

double Area() const{

return PI*r*r

}

private:

Point c

double r

}

int main() {

Shape** shapes = new Shape*[2]

shapes[0] = new Rectangle(0.0,0.0,4.0,5.0)

shapes[0]->SetColor(White)

shapes[1] = new Circle(0.0,0.0,4.0)

shapes[1]->SetColor(Black)

for(int i(0)i<2i++){

cout <<"Area="<<shapes[i]->Area()<<endl

cout <<"Color="<<shapes[i]->Color()<<endl

}

delete[] shapes

return 0

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/11723010.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存