Latihan :
Kode jurusan <input>
Kelas <input>
Nama jurusan <tampil>
Biaya kuliah <tampil>
Ketentutan soal :
Kode jurusan | Nama jurusan | Kelas | Biaya kuliah |
MI | Manajemen Informatika | Pagi | 980000 |
sore | 1080000 | ||
weekend | 1500000 | ||
AK | Akuntansi Komputer | Pagi | 9000000 |
Sore | 1000000 | ||
TI | Teknik Informatika | Pagi | 1200000 |
Sore | 1500000 |
dibawah ini listing program dan outputnya :
#include<conio.h>
#include<iostream.h>
#include<string.h>
main()
{
char kode[2],kelas[10],nama[30];
long bk;
cout<<"Kode Jurusan : ";cin>>kode;
cout<<"Kelas : ";cin>>kelas;
strupr(kode);
strlwr(kelas);
if (strcmp(kode,"MI")==0)
{
strcpy(nama,"Manajemen Informatika");
if(strcmp(kelas,"pagi")==0)
bk=980000;
else if (strcmp(kelas,"sore")==0)
bk=1080000;
else if (strcmp(kelas,"weekend")==0)
bk=1500000;
else
bk=0;
}
if (strcmp(kode,"AK")==0)
{
strcpy(nama,"Akuntansi Komputer");
if(strcmp(kelas,"pagi")==0)
bk=900000;
else if (strcmp(kelas,"sore")==0)
bk=1000000;
else
bk=0;
}
if (strcmp(kode,"TI")==0)
{
strcpy(nama,"Teknik Informatika");
if(strcmp(kelas,"pagi")==0)
bk=1200000;
else if (strcmp(kelas,"sore")==0)
bk=1500000;
else
bk=0;
}
cout<<"Nama Jurusan : "<<nama<<endl;
cout<<"Biaya Kuliah : "<<bk<<endl;
getch();
}
0 komentar:
Posting Komentar