pada kali ini saya akan share mencari coding nilai tertinggi mahasiswa
lihat gambar berikut
jika anda tertarik anda tinggal copy paste aja :)
# include <iostream.h>
# include <conio.h>
# include <stdio.h>
char grade1(float x);
float rata2(float x);
main()
{
char nama[25][10];
int Nilai[25][10];
float total[100];
int n, maks;
float nilaimaks;
//input jumlah mahasiswa secara bebas
printf("input siswa maksimum : ");
scanf("%d", &n);
//Input data
for(int i=0; i<n; i++){
cout<<"Input Nama ke-"<<i+1<<" :";
cin>>nama[i];
cout<<"Input Tugas-1 ";
cin>>Nilai[i][0];
cout<<"Input Tugas-2 ";
cin>>Nilai[i][1];
cout<<"Input Tugas-3 ";
cin>>Nilai[i][2];
}
clrscr();
//Membuat tampilan (output)
cout<<"Nama"<<"\t"<<"Tugas-1"<<"\t"<<"Tugas-2"<<"\t"<<"Tugas-3"<<"\t"<<"Total"<<"\t"<<"Rata2"<<"\t"<<"Grade"<<"\n";
for(int i=0; i<n; i++){
total[i]=Nilai[i][0]+Nilai[i][1]+Nilai[i][2];
cout<<nama[i]<<"\t"<<Nilai[i][0]<<"\t"<<Nilai[i][1]<<"\t"<<Nilai[i][2]<<"\t"<<total[i]<<"\t"<<rata2(total[i])<<"\t"<<grade1(rata2(total[i]))<<"\n";
}
//mencari nilai tertinggi
for(int i=0; i<n; i++){
if(nilaimaks < total[i]){
nilaimaks = total[i];
maks=i;
}
}
cout<<"\n"<<"nilai paling tinggi :"<<" "<<nama[maks];
getch();
}
//fungsi mencari nilai rata-rata
float rata2(float x){
float rata2;
rata2=x/3;
return rata2;
}
//fungsi mencari grade
char grade1(float x){
char grade;
if(x<51)
grade='F';
else if(x<81)
grade='B';
else
grade='A';
return grade;
}
sekian dan terima kasih :)
lihat gambar berikut
jika anda tertarik anda tinggal copy paste aja :)
# include <iostream.h>
# include <conio.h>
# include <stdio.h>
char grade1(float x);
float rata2(float x);
main()
{
char nama[25][10];
int Nilai[25][10];
float total[100];
int n, maks;
float nilaimaks;
//input jumlah mahasiswa secara bebas
printf("input siswa maksimum : ");
scanf("%d", &n);
//Input data
for(int i=0; i<n; i++){
cout<<"Input Nama ke-"<<i+1<<" :";
cin>>nama[i];
cout<<"Input Tugas-1 ";
cin>>Nilai[i][0];
cout<<"Input Tugas-2 ";
cin>>Nilai[i][1];
cout<<"Input Tugas-3 ";
cin>>Nilai[i][2];
}
clrscr();
//Membuat tampilan (output)
cout<<"Nama"<<"\t"<<"Tugas-1"<<"\t"<<"Tugas-2"<<"\t"<<"Tugas-3"<<"\t"<<"Total"<<"\t"<<"Rata2"<<"\t"<<"Grade"<<"\n";
for(int i=0; i<n; i++){
total[i]=Nilai[i][0]+Nilai[i][1]+Nilai[i][2];
cout<<nama[i]<<"\t"<<Nilai[i][0]<<"\t"<<Nilai[i][1]<<"\t"<<Nilai[i][2]<<"\t"<<total[i]<<"\t"<<rata2(total[i])<<"\t"<<grade1(rata2(total[i]))<<"\n";
}
//mencari nilai tertinggi
for(int i=0; i<n; i++){
if(nilaimaks < total[i]){
nilaimaks = total[i];
maks=i;
}
}
cout<<"\n"<<"nilai paling tinggi :"<<" "<<nama[maks];
getch();
}
//fungsi mencari nilai rata-rata
float rata2(float x){
float rata2;
rata2=x/3;
return rata2;
}
//fungsi mencari grade
char grade1(float x){
char grade;
if(x<51)
grade='F';
else if(x<81)
grade='B';
else
grade='A';
return grade;
}
sekian dan terima kasih :)
Jangan Lupa commen nya dan kunjungi terus blog saya http://berbagitips46.blogspot.com atau http://sahatpg.wordpress.com/
supaya saya lebih giat lagi untuk mencari aplikasi-aplikasi yang
terbaru atau anda bisa request software yang anda ingin kan siapa tau
saya bisa bantu cari
sekian terimakasih semoga bermanfaat ^_^
sekian terimakasih semoga bermanfaat ^_^
0 comments:
Post a Comment