#include <iostream.h>
#include <conio.h>
main(){
struct matakuliah{
char kode[7];
char nama[20];
char kelasmatakuliah[10];
int sks;
};
struct matakuliah matakuliah_mhs[20];
char npm[10];
char nama[20];
char kelas[20];
char jurusan[20];
char semester[3];
int i;
int n;
cout << "NPM : ";
cin >> npm;
cout << "Nama mahasiswa : ";
cin >> nama;
cout << "Kelas : ";
cin >> kelas;
cout << "Jurusan : ";
cin >> jurusan;
cout << "Semester : ";
cin >> semester;
cout << "Jumlah mata kuliah : ";
cin >> n;
cout << "\n";
for(i = 0; i < n; i++){
cout << "Mata kuliah ke-" << i+1 << " : ";
cout << "\n";
cout << "- Kode Mata Kuliah : ";
cin >> matakuliah_mhs[i].kode;
cout << "- Nama Mata Kuliah : ";
cin >> matakuliah_mhs[i].nama;
cout << "- SKS : ";
cin >> matakuliah_mhs[i].sks;
cout << "- Kelas : ";
cin >> matakuliah_mhs[i].kelasmatakuliah;
}
cout << "\n";
cout << "\n";
cout << "PENGAMBILAN MATA KULIAH";
cout << "\n";
cout << "-----------------------";
cout << "\n";
cout << "NPM : " << npm;
cout << "\n";
cout << "Nama : " << nama;
cout << "\n";
cout << "Kelas : " << kelas;
cout << "\n";
cout << "Jurusan : " << jurusan;
cout << "\n";
cout << "Semester : " << semester;
cout << "\n";
cout << "--------------------------------------------";
cout << "\n";
cout << "KodeMK NamaMK SKS Kelas";
cout << "\n";
cout << "--------------------------------------------";
cout << "\n";
for(i = 0; i < n; i++){
cout << "| " << matakuliah_mhs[i].kode << " | " << matakuliah_mhs[i].nama << " | " << matakuliah_mhs[i].sks << " | " << matakuliah_mhs[i].kelasmatakuliah << " |";
cout << "\n";
}
cout << "--------------------------------------------";
cout << "\n";
int total_sks = 0;
for(i = 0; i < n; i++){
total_sks = total_sks + matakuliah_mhs[i].sks;
}
cout << "Total SKS = " << total_sks << " SKS";
cout << "\n";
cout << "Jumlah = " << n << " Mata Kuliah";
cout << "\n";
return 0;
}
Tidak ada komentar:
Posting Komentar