#include<iostream>
#include<stdlib.h>
#include<conio.h>
#include<iomanip.h>
using namespace std;
struct mhs
{
char nim[11];
char nama[12];
float ipk;
};
int main()
{
int maks=-1000;
int min=1000;
int rata;
int i;
mhs ayam[5];
char m[5];
for(i=0;i<3;i++)
{
cout<<"Masukan Nama ["<<i+1<<"] = ";
cin.getline(ayam[i].nama,12);
cout<<"Masukan Nim ["<<i+1<<"] = ";
cin.getline(ayam[i].nim,11);
cout<<"Masukan IPK ["<<i+1<<"] = ";
cin.getline(m,5);
cout<<"\n=============================================================\n\n";
ayam[i].ipk=atof(m);
}
for(i=0;i<3;i++)
{
rata=rata+ayam[i].ipk/3;
if(ayam[i].ipk>maks)
{
maks=ayam[i].ipk;
}
if(ayam[i].ipk<min)
{
min=ayam[i].ipk;
}
cout<<"=============================================================\n";
cout<<"Nama"<<setw(20)<<"Nim"<<setw(17)<<"IPK"<<setw(17)<<"Ket";
cout<<"\n=============================================================\n";
for (i=0;i<3;i++)
{
cout<<setw(2)<<ayam[i].nama<<setw(20)<<ayam[i].nim<<setw(17)<<ayam[i].ipk<<setw(17)<<"Lulus"<<endl;
}
cout<<"Rata-ratanya = "<<rata<<endl;
cout<<"IPK Terbesar Adalah = "<<maks<<endl;
cout<<"IPK terkecil adalah = "<<min<<endl;
cout<<endl;}
getch();
}
#include<stdlib.h>
#include<conio.h>
#include<iomanip.h>
using namespace std;
struct mhs
{
char nim[11];
char nama[12];
float ipk;
};
int main()
{
int maks=-1000;
int min=1000;
int rata;
int i;
mhs ayam[5];
char m[5];
for(i=0;i<3;i++)
{
cout<<"Masukan Nama ["<<i+1<<"] = ";
cin.getline(ayam[i].nama,12);
cout<<"Masukan Nim ["<<i+1<<"] = ";
cin.getline(ayam[i].nim,11);
cout<<"Masukan IPK ["<<i+1<<"] = ";
cin.getline(m,5);
cout<<"\n=============================================================\n\n";
ayam[i].ipk=atof(m);
}
for(i=0;i<3;i++)
{
rata=rata+ayam[i].ipk/3;
if(ayam[i].ipk>maks)
{
maks=ayam[i].ipk;
}
if(ayam[i].ipk<min)
{
min=ayam[i].ipk;
}
cout<<"=============================================================\n";
cout<<"Nama"<<setw(20)<<"Nim"<<setw(17)<<"IPK"<<setw(17)<<"Ket";
cout<<"\n=============================================================\n";
for (i=0;i<3;i++)
{
cout<<setw(2)<<ayam[i].nama<<setw(20)<<ayam[i].nim<<setw(17)<<ayam[i].ipk<<setw(17)<<"Lulus"<<endl;
}
cout<<"Rata-ratanya = "<<rata<<endl;
cout<<"IPK Terbesar Adalah = "<<maks<<endl;
cout<<"IPK terkecil adalah = "<<min<<endl;
cout<<endl;}
getch();
}
Written by: Wahyudi Nugroho
WN UPDATE, Updated at: 01:40
Ditulis Oleh : Unknown | WN Update
Terima Kasih Sudah Membaca Artikel Menentukan Grade, IPK dan Rata-rata dengan Struct c++. Jangan lupa klik +1 dan like artikel ini, dan Sobat juga diperbolehkan mengcopy-paste atau menyebar-luaskan artikel ini, namun jangan lupa untuk meletakkan link dibawah ini sebagai sumbernya
0 komentar:
Post a Comment