Asamualaikum wr wb
Pada posting kali ini saya akan share mengenai program sederhana dengan bahsa pemograman C++ yaitu tantang menentukan nilai (IP) mahasiswa, sebelumnya saya kan menunjukan hasil dari program yaitu :
======================================================================
SOURCE CODE
/*
APLIKASI MENENTUKAN NILAI MAHASISWA
NAMA : DIANA MAYANGSARI RAMADHANI
NRP : 49013047
*/
#include <iostream>
using namespace std;
int main(){
cout << "Diana Mayangsari Ramadhani\n";
cout << "NRP : 49013047\n\n \n";
cout << "APLIKASI MENENTUKAN NILAI INDEKS PRESTASI MAHASISWA\n";
cout << "---------------------------------------------------\n" <<endl;
cout << " Nilai Huruf \n";
cout << " ____________\n";
cout << "| A+ |\n";
cout << "| A |\n";
cout << "| B+ |\n";
cout << "| B |\n";
cout << "| C+ |\n";
cout << "| C |\n";
cout << "| D+ |\n";
cout << "| D |\n";
cout << "| E |\n";
cout << "|____________|\n"<<endl <<endl;
int matkul; // untuk inputan jumlah mata kuliah
char nilai[10], c[1]; //array menampung nilai
float nil=0, nil2=0; //variable nil untuk di proses
float ips; //variable hasil akhir ip
int n_sks, t_sks=0; // jumlah sks dan proses sks
cout << "Masukan jumlah matakuliah : ";
cin >> matkul;
cin.getline(c,1); //agar dapat mengambil cin getline nilai
//perulangan sebanyak matkul
for (int a=1; a<=matkul; a++)
{
cout << a << ". Nilai huruf = "; //cetak
cin.getline(nilai, 3); //inputan
cout << " Jumlah sks = "; //cetak
cin >> n_sks; //inputan
if (strcmp(nilai, "A+") == 0 || strcmp(nilai, "a+") == 0)
nil += (4 * n_sks);
else if (strcmp(nilai, "A") == 0 || strcmp(nilai, "a") == 0)
nil += (3.75*n_sks);
else if (strcmp(nilai, "B+") == 0 || strcmp(nilai, "b+") == 0)
nil += (3.5*n_sks);
else if (strcmp(nilai, "B") == 0 || strcmp(nilai, "b") == 0)
nil += (3*n_sks);
else if (strcmp(nilai, "C+") == 0 || strcmp(nilai, "c+") == 0)
nil += (2.25*n_sks);
else if (strcmp(nilai, "C") == 0 || strcmp(nilai, "c") == 0)
nil += (2*n_sks);
else if (strcmp(nilai, "D+") == 0 || strcmp(nilai, "d+") == 0)
nil += (1.25*n_sks);
else if (strcmp(nilai, "D") == 0 || strcmp(nilai, "d") == 0)
nil += (1*n_sks);
else
nil += (0.25*n_sks);
t_sks += n_sks; // (t_sks = t_sks + n_sks)
cin.getline(c,1);
}
//hitung ips
ips = nil/t_sks;
cout << "\n Indeks Prestasi(IP) anda Semester ini adalah " << ips <<endl;
cout << endl;
system("pause");
return 0;
}
=======================================================================
TUTORIAL VIDEO DAPAT DI LIHAT DI
Sekian posting dari saya, semiga bermanfaat yak, semangat belajar! :)
Tidak ada komentar:
Posting Komentar