Friday, 22 December 2023

Daftar Nilai

 #include<conio.h>

#include<stdio.h>

#include<iostream>

#include<iomanip>

using namespace std;


int main(){

int a, n;

string NamaKampus, AlamatKampus;

cout << " Masukan Nama Kampus      : " ; getline(cin, NamaKampus);

cout << " Masukan Alamat Kampus    : " ; getline(cin, AlamatKampus);

cout << " Masukan Jumlah Mahasiswa : " ; cin >> a;

int nim[a], tugas[a], uts[a], uas[a], TotalNilai[a];

string nama[a], ket[a];

char kelas[a], NilaiHuruf[a];

for (n = 0; n < a; n++){

cout << " Data Input Nilai Kuliah Mahasiwa Ke - " << n+1 <<endl;

cout << " Masukan Nama             : " ; cin >> nama[n];

cout << " Masukan NIM              : " ; cin >> nim[n];

cout << " Masukan Kelas            : " ; cin >> kelas[n];

cout << " Masukan Nilai Tugas      : " ; cin >> tugas[n];

cout << " Masukan Nilai UTS        : " ; cin >> uts[n];

cout << " Masukan Nilai UAS        : " ; cin >> uas[n];

TotalNilai[n] = tugas[n] * 0.3 + uts[n] * 0.3 + uas[n] * 0.4;

if (TotalNilai[n] > 85){

NilaiHuruf[n] = 'A';

ket[n] = " Lulus ";

}

else if (TotalNilai[n] >= 75){

NilaiHuruf[n] = 'B';

ket[n] = " Lulus ";

}

else if (TotalNilai[n] >= 65){

NilaiHuruf[n] = 'C';

ket[n] = " Lulus ";

}

else if (TotalNilai[n] >= 45){

NilaiHuruf[n] = 'D';

ket[n] = " Tidak Lulus ";

}

else{

NilaiHuruf[n] = 'E';

ket[n] = " Tidak Lulus ";

}

  }

system("cls");

cout << " Nama Kampus   : " << NamaKampus <<endl;

cout << " Alamat Kampus : " << AlamatKampus <<endl;

    cout << "=========================================================================================================" << endl;

cout << "                                         DATA NILAI AKHIR MAHASISWA                                     |" << endl;

cout << "=========================================================================================================" << endl;

  cout << "| NO |       Nama         |   Nim   | Kelas | Tugas |  UTS | UAS | Total | Nilai Huruf |   Keterangan   | " << endl;

  cout << "=========================================================================================================" << endl;

    for (n = 0; n < a; n++) 

{

     cout << "|" <<setiosflags(ios::left) <<setw(4) <<n+1 <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(19) <<nama[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(8) <<nim[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(6) <<kelas[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(6) <<tugas[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(5) <<uts[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(4) <<uas[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(6) <<TotalNilai[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(12) <<NilaiHuruf[n] <<"|";

     cout << " " <<setiosflags(ios::left) <<setw(15) <<ket[n] <<"|" <<endl;

    }

    cout << "=========================================================================================================" << endl;

    getch();


}

No comments:

Post a Comment