我被困在这里,请帮助我[关闭]

Enter courses, credits, student numbers, names, attendance numbers, assignments, final semester exam scores, and final semester exam scores, after that add up attendance numbers with assignments, midterm grades, and final exam scores, with the provision,enter image description here is that attendance is 10%, assignment value is 20%, midterm value is 30%, and UAS value is 40% If the result of the total value is obtained, if the result is more than 80 then the grade is A, but if the result is less than 80 and greater than 70 then the grade is B, but if the result is less than 70 and greater than 60 then the grade is C, but if the result is less than 60 and greater than 50 then the grade is D, but if the result is less than 50 then the grade is E.

#include <iostream>
#include <string>
using namespace std;
main()

{
cout << "====ENTRY DATA NILAI====" << endl << endl;

int nim, nama, matakuliah, absen, tugas, quiz, uts, uas, bnilai;

char nim[11];
char nama[50];
char matakuliah[25];

    cout << "Nim :"; cin >> nim;
    getline(nim, sizeof(nim));

    cout << "Nama :"; cin >> nama;
    getline(nama, sizeof(nama));

    cout << "Mata Kuliah :"; cin >> matakuliah;
    getline(matakuliah, sizeof(matakuliah));

    cout << "Absensi :"; cin >> absen;
    getline(absen, sizeof(absen));

    cout << "Nilai Tugas :"; cin >> tugas;
    getline(tugas, sizeof(tugas));

    cout << "Nilai Quiz :"; cin >> quiz;
    getline(quiz, sizeof(quiz));

    cout << "Nilai UTS :"; cin >> uts;
    getline(uts, sizeof(uts));

    cout << "Nilai UAS :"; cin >> uas;
    getline(uas, sizeof(uas));

    bnilai = (absen * 10 / 100) + (tugas * 20 / 100) + (uts * 30 / 100) + (uas * 40 / 100);

    cout << "Bobot Nilai :" << bnilai << endl;

printf("Nilai Huruf :");

if (bnilai >= 80 && bnilai <= 100) {
    printf("A");
}
else if (bnilai >= 70 && bnilai < 80) {
    printf("B");

}
else if (bnilai >= 60 && bnilai < 70) {
    printf("C");

}
else if (bnilai >= 40 && bnilai < 60) {
    printf("D");
}
else if (bnilai >= 0 && bnilai < 40) {
    printf("E");

}

}

评论