#include"conio.h"
#include<iostream.h>
void main()
{
char nama[50]['i'],nim[50]['i'];
int i;
float a['i'],total= 0,rata2;
cout<<" ^* PROGRAM PENERJEMAH NILAI *^ ";
cout<<"Masukkan input pengulangan : ";
cin>>i;
for(int c=1; c<=i ;c++)
{
cout<<"pengulangan ke "<<c<<endl;
cout<<"Nama : ";
cin>>nama[c];
cout<<"NIM : " ;
cin>>nim[c];
nilai:
cout<<"nilai: ";
cin>>a[c];
cout<<"grade: ";
if(a[c]>=0 && a[c]<=29)
{
cout<<"E";
}
else if(a[c]>=30 && a[c]<=49)
{
cout<<"D";
}
else if(a[c]>=50 && a[c]<=70)
{
cout<<"C";
}
else if(a[c]>=71 && a[c]<=85)
{
cout<<"B";
}
else if(a[c]>=86 && a[c]<=100)
{
cout<<"A";
}
else
{
cout<<"maaf,nilai yang anda masukkan salah"<<endl;
goto nilai;
}
total= total + a[c];
rata2= total / i;
cout<<endl<<"---------------"<<endl;
}
cout<<"Total = "<<total<<endl;
cout<<"Rata2 = "<<rata2<<endl;
getch();
}
#include<iostream.h>
void main()
{
char nama[50]['i'],nim[50]['i'];
int i;
float a['i'],total= 0,rata2;
cout<<" ^* PROGRAM PENERJEMAH NILAI *^ ";
cout<<"Masukkan input pengulangan : ";
cin>>i;
for(int c=1; c<=i ;c++)
{
cout<<"pengulangan ke "<<c<<endl;
cout<<"Nama : ";
cin>>nama[c];
cout<<"NIM : " ;
cin>>nim[c];
nilai:
cout<<"nilai: ";
cin>>a[c];
cout<<"grade: ";
if(a[c]>=0 && a[c]<=29)
{
cout<<"E";
}
else if(a[c]>=30 && a[c]<=49)
{
cout<<"D";
}
else if(a[c]>=50 && a[c]<=70)
{
cout<<"C";
}
else if(a[c]>=71 && a[c]<=85)
{
cout<<"B";
}
else if(a[c]>=86 && a[c]<=100)
{
cout<<"A";
}
else
{
cout<<"maaf,nilai yang anda masukkan salah"<<endl;
goto nilai;
}
total= total + a[c];
rata2= total / i;
cout<<endl<<"---------------"<<endl;
}
cout<<"Total = "<<total<<endl;
cout<<"Rata2 = "<<rata2<<endl;
getch();
}
0 comments:
Post a Comment
Komentar sobat akan saya hapus jika:
- Mengandung unsur SPAM
- LINK hidup
- tidak sesuai dengan topik
NB:
jika ingin menyisipkan LINK ,silahkan pilih Name/URL pada option profil !