第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

求矩形的周長和面積

怎么改這個代碼

#include<iostream>

using namespace std;

class juxing?

{

int a,b;

double s,c;

public:

juxing(){};

juxing(int new_a)

{

a=new_a;

b=new_a;

}

juxing(int new_a,int new_b)

{

a=new_a;

b=new_b;

}

juxing(juxing &d)

{

a=d.a;

b=d.b;

}

double gets()

{

s=a*b;

return s;

}

double getc()

{

c=2*a+2*b;

return c;

}

};

int main()

{

juxing A1,A2(2),A3(5,3),A4(A3);

cout<<A1.getc()<<" "<<A1.gets()<<endl;

cout<<A2.getc()<<" "<<A2.gets()<<endl;

cout<<A3.getc()<<" "<<A3.gets()<<endl;

cout<<A4.getc()<<" "<<A4.gets()<<endl;

return 0;

}


正在回答

1 回答

#include<iostream>

#include<stdlib.h>

#include<string>

using namespace std;


class orthogon

{

public:

double length;

double wide;

double perimeter(double a,double b)

{

double L;

L = 2 * (a + b);

return L;

}

double area(double a,double b)

{

double S;

S = a * b;

return S;

}

};

int main(int)

{

orthogon Ort;

cout << "please input the Ort.length:" << endl;

cin >> Ort.length;

cout << "please input the Ort.wide" << endl;

cin >> Ort.wide;

cout << Ort.perimeter(Ort.length, Ort.wide) << endl;

cout << Ort.area(Ort.length, Ort.wide) << endl;

system("pause");

return 0;

}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

嫫媣 提問者

非常感謝!
2017-04-11 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
C++遠(yuǎn)征之封裝篇(上)
  • 參與學(xué)習(xí)       103386    人
  • 解答問題       732    個

封裝--面向?qū)ο蟮幕?,本教程力求幫助小伙伴們即學(xué)即會

進(jìn)入課程

求矩形的周長和面積

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號