C / C++ Code Portfolio



Download 112,15 Kb.
bet19/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   15   16   17   18   19   20   21   22   ...   30
Bog'liq
dddd

double lengthOfSide;
};
}

#endif // !CHRISBERGER_SHAPES_H


#include "Shapes.h"


#include

using std::cout;

// constructor for a Circle taking one double argument


ChrisBerger::Circle::Circle(double radius) : radius(radius)
{ }

// virtual function to display a Circle


void
ChrisBerger::Circle::display() const
{
cout << "Circle with radius " << radius << " has area " << getArea() << "\n";
}

// virtual function to return the area of a Circle


double
ChrisBerger::Circle::getArea() const
{
return (3.14 * radius * radius);
}

// constructor for a Square taking one double argument


ChrisBerger::Square::Square(double lengthOfSide) : lengthOfSide(lengthOfSide)
{ }

// virtual function to display a Square


void
ChrisBerger::Square::display() const
{
cout << "Square with length of side " << lengthOfSide << " has area " << getArea() << "\n";
}

// virtual function to return the area of a Square


double
ChrisBerger::Square::getArea() const
{
return (lengthOfSide * lengthOfSide);
}

// constructor for a Sphere taking one double argument


ChrisBerger::Sphere::Sphere(double radius) : radius(radius)
{ }

// virtual function to display a Sphere


void
ChrisBerger::Sphere::display() const
{
cout << "Sphere with radius " << radius << " has surface area " << getSurfaceArea() <<
" and volume " << getVolume() << "\n";
}

// virtual function to return the surface area of a Sphere


double
ChrisBerger::Sphere::getSurfaceArea() const
{
return (4 * 3.14 * radius * radius);
}

// virtual function to return the volume of a Sphere



Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   15   16   17   18   19   20   21   22   ...   30




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish