#include <iostream> #define maks 100 #include<stdlib.h> using namespace std; struct mhs{ char nama[maks]; string nim; float nilai; char fakultas[maks]; }; void utama(){ mhs m[maks]; string nama_max, nama_min; float nilai_max, nilai_min; int j; float jum=0,rata; cout<<"\t\tINI INPUT"<<endl; cout<<"Masukkan jumlah mahasiswa = "; cin>>j; for (int i=0; i<j; i++){ cout<<"========================="<<endl; cout<<"Biodata Mahasiswa ke "<<i+1<<endl; cout<<"Masukkan Nama : "; cin>>m[i].nama; cout<<"Masukkan Nim : "; cin>>m[i].nim; cout<<"Masukan IPK : "; cin>>m[i].nilai; jum+=m[i].nilai; cout<<"Masukkan fakultas : "; cin>>m[i].fakultas; cout<<"\n"; }rata=jum/j; system("CLS"); cout<<"\t\tINI OUTPUT"<<endl; for (int i=0; i<j; i++){ cout<<"========================="<<endl; cout<<"Biodata Mahasiswa ke "<<i+1<<endl; cout<<"Nama : "<<m[i].nama<<endl; cout<<"Nim : "<<m[i].nim<<endl; cout<<"Fakultas : "<<m[i].fakultas<<endl; cout<<"IPK : "<<m[i].nilai<<endl<<endl; } cout<<"Nilai Rata-Rata IPK = "<<rata<<endl; nilai_max=m[0].nilai; nilai_min=m[0].nilai; for(int i=0; i<j; i++ ){ if(m[i].nilai==nilai_max){ nilai_max=m[i].nilai; } else if(m[i].nilai>nilai_max){ nilai_max = m[i].nilai; nama_max = m[i].nama; } } for(int i=0; i<j; i++ ){ if(m[i].nilai==nilai_min){ nilai_min=m[i].nilai; } else if(m[i].nilai<nilai_min){ nilai_min=m[i].nilai; nama_min=m[i].nama; } } cout<<"IPK tertinggi "<<nilai_max<< " diperoleh " << nama_max <<endl; cout<<"IPK terendah "<<nilai_min << " diperoleh " << nama_min <<endl; } int main(){ utama(); return 0; }