Guruh talabasi Nutfulloyev Sohibning Dasturlash -1 fanidan bajargan 3- laboratoriya topshirig’i


Download 198.61 Kb.
bet3/3
Sana13.11.2020
Hajmi198.61 Kb.
#144809
1   2   3
Bog'liq
lab3


Case4. Oy raqami berilgan. Shu oyda nechta kun borligini aniqlovchi dastur tuzilsin.

Dastur:


#include 

#include 

using namespace std;

int main()

{

    int oyRaqami;



    cin >> oyRaqami;

    string oyNomi, oyKuni;

    switch (oyRaqami) {

    case 1:

        oyNomi = "Yanvar";

        oyKuni = "31";

        break;

    case 2:

        oyNomi = "Fevral";

        oyKuni = "28 yoki 29";

        break;

    case 3:

        oyNomi = "Mart";

        oyKuni = "31";

        break;

    case 4:

        oyNomi = "Aprel";

        oyKuni = "30";

        break;

    case 5:

        oyNomi = "May";

        oyKuni = "31";

        break;

    case 6:

        oyNomi = "Iyun";

        oyKuni = "30";

        break;

    case 7:

        oyNomi = "Iyul";

        oyKuni = "31";

        break;

    case 8:

        oyNomi = "Avgust";

        oyKuni = "31";

        break;

    case 9:

        oyNomi = "Sentabr";

        oyKuni = "30";

        break;

    case 10:

        oyNomi = "Oktabr";

        oyKuni = "31";

        break;

    case 11:

        oyNomi = "Noyabr";

        oyKuni = "30";

        break;

    case 12:

        oyNomi = "Dekabr";

        oyKuni = "31";

        break;

    default:

        main();

    }


    cout << oyNomi << " oyida " << oyKuni << " kun bor";

    return 0;



}

Natija:



Download 198.61 Kb.

Do'stlaringiz bilan baham:
1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling