Tuesday, 9 May 2023

Program seleksi nilai

 #include <iostream>

#include <iomanip>

using namespace std;


int main (){

string nama[6];

string status[5];

float nilai_ujian[6];

int b;

cout<<"Masukan Jumlah mahasiswa : ";

cin>>b;

for (int i = 1; i <= b; i++){

cout<<"Masukan Nama Mahasiswa : ";

cin>>nama[i];

cout<<"masukan NIlai Ujian\t : ";

cin>>nilai_ujian[i];

if (nilai_ujian[i] >= 7){

status[i] = "Lulus Ujian";

}else {

status[i] = "Tidak Lulus ujian";

}

}

cout<<"-------------------------------------------\n";

cout<<"|   Nama   | Nilai |       Status         |\n";

cout<<"-------------------------------------------\n";

for (int j = 1; j <=b; j++){

cout<<setw(8)<<nama[j]<<setw(10)<<nilai_ujian[j]<<setw(20)<<status[j]<<endl;

}

}

No comments:

Post a Comment