Microsoft Visual C++/cli step by Step



Download 2,23 Mb.
Pdf ko'rish
bet60/102
Sana31.12.2021
Hajmi2,23 Mb.
#228061
1   ...   56   57   58   59   60   61   62   63   ...   102
Bog'liq
Visual studio C step by step

 

CHAPTER 5

 

Decision and loop statements 



 65

Year

Leap year?

1996


Yes

1997


No

1900


No

2000


Yes

You then use a nested if statement to test the bool variable isLeapYear so that you can assign an ap-

propriate value to maxDay.

Note  There is no explicit test in the nested if statement. The condition if (isLeapYear) is 

equivalent to if (isLeapYear != false).

In this exercise, you will enhance your Calendar Assistant application to deal correctly with leap 

years.


1. 

Continue working with the project from the previous exercise.



2. 

Modify the GetDay function, replacing the if…else if…else statements to match the block of 

code just described to test for leap years.

3. 

Build and run the application. Type the year 1996 and the month 2. The application prompts 

you to enter a day between 1 and 29. Type a valid day and then when the date is displayed, 

close the console window.



4. 

Run the application again. Type the year 1997 and the month 2. Verify that the application 

prompts you to enter a day between 1 and 28.

5. 

Run the application several more times using the test data from the previous table.




Download 2,23 Mb.

Do'stlaringiz bilan baham:
1   ...   56   57   58   59   60   61   62   63   ...   102




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