C / C++ Code Portfolio


in >> temp; // read in the imaginary component which will be sans sign in



Download 112,15 Kb.
bet17/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   13   14   15   16   17   18   19   20   ...   30
Bog'liq
dddd

in >> temp;
// read in the imaginary component which will be sans sign
in >> tempImaginary;
// if the sign of the imaginary component is negative, negate the imaginary component
if (temp == '-')
{
tempImaginary *= -1;
}
// set the imaginary component of the Complex to the read in complex component
value.imaginary = tempImaginary;
// read in the "i"
in >> temp;
return in;
}
Inheritance and Virtual Functions
#ifndef CHRISBERGER_SHAPES_H
#define CHRISBERGER_SHAPES_H

namespace ChrisBerger
{
// this abstract class serves as the base type for all other classes
class Shape
{
public:
// purely virtual function to display a Shape
virtual void display() const = 0;
};

// this abstract class is the parent class for Circle and Square types


class TwoDimensionalShape : public Shape
{
public:
// purely virtual function to get the area of a Shape
virtual double getArea() const = 0;
};

// this abstract class is the parent class for Sphere and Cube types


class ThreeDimensionalShape : public Shape
{
public:
// purely virtual function to get the surface area of a Shape
virtual double getSurfaceArea() const = 0;
// purely virtual function to get the volume of a Shape
virtual double getVolume() const = 0;
};

// class for a Shape of type Circle


class Circle : public TwoDimensionalShape
{
public:
// prototype for the Circle constructor
Circle(double radius);
// virtual function prototype to display a Circle
virtual void display() const;
// virtual function prototype to get the area of a Circle

Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   13   14   15   16   17   18   19   20   ...   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