Microsoft Visual C++/cli step by Step


   Microsoft Visual C++/CLI Step by Step



Download 2,23 Mb.
Pdf ko'rish
bet55/102
Sana31.12.2021
Hajmi2,23 Mb.
#228061
1   ...   51   52   53   54   55   56   57   58   ...   102
Bog'liq
Visual studio C step by step

60  

Microsoft Visual C++/CLI Step by Step

// Simplified test for now – assume there are 31 days in  

// every month :-) 

if (month >= 1 && month <= 12 && day >= 1 && day <= 31) 

    DisplayDate(year, month, day); 



Console::WriteLine("\nThe end\n");

This code asks the user to enter a year, month, and day. If the date passes a simplified valida-

tion test, the date is displayed on the console. If the date is invalid, it is not displayed at all.



Note This if statement combines several tests by using the logical AND operator &&

As you learned in Chapter 3, “Variables and operators,” logical tests are performed 

from left to right. Testing stops as soon as the final outcome has been established. 

For example, if the month is 0, there is no point performing the other tests—the 

date is definitely invalid. This is known as short-circuit evaluation.

8. 

Build the application and fix any compiler errors that you might have.



9. 

Run the application. Type in valid numbers for the year, month, and day (for example, 20127

and 22).

The application displays the messages shown in the following screen shot:

Observe that the application displays the date because it is valid. The message “The End” also 

appears at the end of the program.



10. 

Run the application again, but this time, type an invalid date (for example, 20122, and 33). 

The application displays the messages shown in the following screen shot:




Download 2,23 Mb.

Do'stlaringiz bilan baham:
1   ...   51   52   53   54   55   56   57   58   ...   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