C / C++ Code Portfolio


else { // close the file files[currentFile].close(); } } } } } Headers and Inline Functions



Download 112,15 Kb.
bet13/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   9   10   11   12   13   14   15   16   ...   30
Bog'liq
dddd

else
{
// close the file
files[currentFile].close();
}
}
}
}
}
Headers and Inline Functions
// This header file includes two inline functions that return the maximum of 2 or 3 numbers
// and two function-like macros that return the maximum of 2 or 3 numbers

// include guard


#ifndef C1A4E4_MAXOF_H
// begin definition of C1A4E4_MAXOF_H
#define C1A4E4_MAXOF_H
//declare inline function fMaxOf2 which returns the maximum of 2 numbers
inline long double fMaxOf2(long double firstNum, long double secondNum)
{
// return the maximum of two numbers
return((firstNum > secondNum) ? firstNum : secondNum);
}
// declare inline function fMaxOf3 which returns the maximum of 3 numbers
inline long double fMaxOf3(long double firstNum, long double secondNum, long double thirdNum)
{
// return the maximum of three numbers
return fMaxOf2(firstNum, fMaxOf2(secondNum, thirdNum));
}
// declare function-like macro mMaxOf2 which returns the maximum of 2 numbers
#define mMaxOf2(firstNum, secondNum) ((firstNum) > (secondNum) ? (firstNum) : (secondNum))
// declare function-like macro mMaxOf3 which returns the maximum of 3 numbers
#define mMaxOf3(firstNum, secondNum, thirdNum) (mMaxOf2((firstNum), mMaxOf2((secondNum), (thirdNum))))

// end of include guard


#endif
Class Example: Savings Account
#ifndef CHRISBERGER_SAVINGSACCOUNT_H
#define CHRISBERGER_SAVINGSACCOUNT_H
namespace ChrisBerger
{
class SavingsAccount
{
public:
// ptototype for constructor taking one double argument
SavingsAccount(double initialBalance);
// getter for savingsBalance
double getSavingsBalance() const;
// setter for annualInterestRate

Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   9   10   11   12   13   14   15   16   ...   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