Microsoft Visual C++/cli step by Step



Download 2,23 Mb.
Pdf ko'rish
bet71/102
Sana31.12.2021
Hajmi2,23 Mb.
#228061
1   ...   67   68   69   70   71   72   73   74   ...   102
Bog'liq
Visual studio C step by step

 

CHAPTER 5

 

Decision and loop statements 



 73

    while (month < 1 || month > 12); 

    return month; 

}

3. 

Modify the GetDay function as follows, which forces the user to type a valid day:

int GetDay(int year, int month) 

    int day = 0; 



    int maxDay; 

 

    // Calculate maxDay, as before (code not shown here) … … … 



 

    do 


    { 

        Console::Write("Day [1 to "); 

        Console::Write(maxDay); 

        Console::Write("]? "); 

        String ^input = Console::ReadLine(); 

        day = Convert::ToInt32(input); 

    } 

    while (day < 1 || day > maxDay); 



    return day; 

}

4. 

Build and run the application.

5. 

Try to type an invalid month. The application keeps asking you to enter another month until 

you type a value between 1 and 12, inclusive.

6. 

Try to type an invalid day. The application keeps asking you to enter another day until you 

type a valid number (which depends on your chosen year and month).


Download 2,23 Mb.

Do'stlaringiz bilan baham:
1   ...   67   68   69   70   71   72   73   74   ...   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