Nazariy ma’lumotlar Маълумотларнинг ихтиёрий тури қийматлар соҳаси ва улар устида бажарилиши мумкин бўлган амаллар орқали тавсифланади void


Download 145.75 Kb.
bet6/6
Sana13.11.2023
Hajmi145.75 Kb.
#1769538
1   2   3   4   5   6
Bog'liq
ShukrullayevMTA3

15 – variant

Masala :



#include


#include
#include

using namespace std;

struct Student {
string surname;
string firstName;
int yearOfBirth;
int dsAndAlgoGrade;
int higherMathGrade;
int physicsGrade;
int programmingGrade;
int totalScore;
};

bool compareByHigherMathGrade(const Student& a, const Student& b) {


return a.higherMathGrade > b.higherMathGrade;
}

int main() {


int N;

cout << "talabalar soni: ";


cin >> N;

vector students(N);

for (int i = 0; i < N; ++i) {
cout << i + 1 << ": talaba malumoti \n";
cout << "Familiya: ";
cin >> students[i].surname;
cout << "Ismi: ";
cin >> students[i].firstName;
cout << "yili: ";
cin >> students[i].yearOfBirth;
cout << "MTA: ";
cin >> students[i].dsAndAlgoGrade;
cout << "matematika: ";
cin >> students[i].higherMathGrade;
cout << "fizika: ";
cin >> students[i].physicsGrade;
cout << "dasturlash: ";
cin >> students[i].programmingGrade;

students[i].totalScore =


students[i].dsAndAlgoGrade +
students[i].higherMathGrade +
students[i].physicsGrade +
students[i].programmingGrade;

cout << endl;


}

sort(students.begin(), students.end(), compareByHigherMathGrade);

cout << "\nMAtematika imtihon ballari:\n";
for (const auto& student : students) {
cout << "Name: " << student.firstName << " " << student.surname
<< ", Yili: " << student.yearOfBirth
<< ", matematika: " << student.higherMathGrade
<< ", umumiy bal: " << student.totalScore << endl;
}

return 0;


}


Xulosa
Men bu masalani bajarish davomida class, ma’lumotlarning oddiy turlari hisoblangan int , double va stringdan foydalanilgan. Dasturni vazifasi kiritilgan avtomobil haqida ma’lumotlarni ekranga chiqarishdan iborat. Bu dasturni bajarish davomida 1 – kursda o’tilgan bilimlarni mustahkamlab oldik.

Download 145.75 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6




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