Apelsin so’zidan “qirqib olish” va “yopishtirish” lar orqali


Ushbu: familiya, yoshi, ma’lumoti, lavozimi


Download 59.58 Kb.
bet5/13
Sana25.04.2023
Hajmi59.58 Kb.
#1399450
1   2   3   4   5   6   7   8   9   ...   13
Bog'liq
Algoritmik tillar va dasturlash

    Bu sahifa navigatsiya:
  • Ushbu
Ushbu: familiya, yoshi, ma’lumoti, lavozimi maydonlariga ega Ishchi sinfini tuzing. Elementlari Ishchi obyektlaridan iborat massiv yarating. Ishchilarni yoshi bo’yicha saralang, yoshi 30 dan katta va oliy ma’lumotli ishchilarni chiqaring.

#include


#include
#include

using namespace std;


struct Ishchi {


string familiya;
int yoshi;
string ma_lumoti;
string lavozimi;
};

int main() {


const int ARRAY_SIZE = 5;
Ishchi ishchilar[ARRAY_SIZE] = {
{"Aliyev", 25, "Diplom", "Menejer"},
{"Karimov", 32, "Talaba", "Ishchi"},
{"Nazarov", 40, "Magistr", "Direktor"},
{"Olimov", 28, "Diplom", "Xodim"},
{"Sharipov", 35, "Doktorant", "Professor"}
};

cout << "30 dan yuqori ishchilar:" << endl;


for (int i = 0; i < ARRAY_SIZE; i++) {
if (ishchilar[i].yoshi > 30) {
cout << ishchilar[i].familiya << endl;
}
}

cout << "\nOliy ma'lumot sohiblari:" << endl;


for (int i = 0; i < ARRAY_SIZE; i++) {
if (ishchilar[i].ma_lumoti == "Doktorant" || ishchilar[i].ma_lumoti == "Magistr") {
cout << ishchilar[i].familiya << endl;
}
}

return 0;


}



  1. Ushbu: familiya, yosh, o’yinlar soni, gollar soni maydonlariga ega Player sinfini tuzing. Elementlari Player obyektlaridan iborat massiv yarating. Futbolchilarning o’rtacha yoshi topilsin va ularni familiyasi bo’yicha saralang.

#include


#include
#include

using namespace std;


class Player {


public:
string familiya;
int yosh;
int oynlar_soni;
int gollar_soni;
};

int main() {


const int size = 3;
Player players[size];
int yoshlar[size] = {25, 28, 23};
string familiyalar[size] = {"Aliyev", "Ismayilov", "Ibrahimov"};
int oynlar_soni[size] = {12, 15, 9};
int gollar_soni[size] = {5, 11, 3};
for(int i=0; i < size; i++) {
players[i].yosh = yoshlar[i];
players[i].familiya = familiyalar[i];
players[i].oynlar_soni = oynlar_soni[i];
players[i].gollar_soni = gollar_soni[i];
}

cout << "Familiya\tYosh\tO'yinlar soni\tGollar soni" << endl;


for(int i=0; i < size; i++) {
cout << players[i].familiya << "\t\t" << players[i].yosh << "\t" << players[i].oynlar_soni << "\t\t" << players[i].gollar_soni << endl;
}

return 0;


}




  1. Download 59.58 Kb.

    Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   ...   13




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