C / C++ Code Portfolio



Download 112,15 Kb.
bet22/30
Sana01.03.2022
Hajmi112,15 Kb.
#475852
1   ...   18   19   20   21   22   23   24   25   ...   30
Bog'liq
dddd

Function Overloading
// This program displays a character a user-specified number of times per row and for a user-specified
// number of rows.

#include // standard I/O strearm "header" file


#include // standard general "header" file

using namespace std; // make all names in "std" namespace visible

// number of types to prompt the user for input


const int NUM_PROMPTS = 5;

// function prototype for PrintLines with 3 input args


void PrintLines(int displayChar, int numColumns, int numRows);
// function prototype for PrintLines with 2 input args
void PrintLines(int displayChar, int numColumns);
// function prototype for PrintLines with 1 input arg
void PrintLines(int displayChar);
// function prototype for PrintLines with 0 input args

void PrintLines();

int main() // declare function main
{
for (int prompt = 0; prompt < NUM_PROMPTS; ++prompt) // loop numPrompts times
{
int numColumns, numRows; // declare num of characters and num of lines
char displayChar; // declare the character to print

//prompt the user to input the character to display, number of times to display, and number of rows


cout << "Enter character to display, number of types to display character on each "
"line, and number of lines to display: ";
// read in character to display, number of times to display, and number of rows
cin >> displayChar >> numColumns >> numRows;

PrintLines(int(displayChar), numColumns, numRows); // call PrintLines with 3 input args


PrintLines(int(displayChar), numColumns); // call PrintLines with 2 input args
PrintLines(int(displayChar)); // call PrintLines with 1 input args
PrintLines(); // call PrintLines with 0 input args
}


Download 112,15 Kb.

Do'stlaringiz bilan baham:
1   ...   18   19   20   21   22   23   24   25   ...   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