// program untuk melihat nilai ahir test
// nilai A jika nilai di atas 80, B jika 70 <= nilai < 80
// c jika 50 <= nilai kurang < 70, D jika 30 <= nilai< 50
// E jika nilai < 30
# include <iostream.h>
void main()
{
int nilai;
cout<<"masukan nilai test : ";
cin>>nilai;
switch (nilai/10)
{
case 10:
case 9:
case 8:
cout<<'A'<<endl;break;
case 7:
cout<<'B'<<endl;break;
case 6:
case 5:
cout<<'C'<<endl;break;
case 4:
case 3:
cout<<'D'<<endl;break;
case 2:
case 1:
case 0:
cout<<'E'<<endl;break;
default:
cout<<"salah, nilai di luar jangkauan"<<endl;
}
}
output
masukan nilai test 95
A
Friday, 13 January 2012
CPP
0 Response to "contoh 25"
Post a Comment