-
Notifications
You must be signed in to change notification settings - Fork 0
/
menghitung spp mahasiswa menggunakan struktur.cpp
60 lines (59 loc) · 1.33 KB
/
menghitung spp mahasiswa menggunakan struktur.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Program menghitung SPP mahasiswa menggunakan struktur, diketahui :
a. D3
- spp tetap Rp500.000
- spp var Rp25.000/sks
b. S1
- spp tetap Rp750.000
- spp var Rp50.000/sks
*/
#include<iostream>
#include<conio.h>
using namespace std;
struct mhs{
char nama[20], nim[10], jurusan[3];
int sks, program;
};
struct mhs bayar[2];
main()
{
int bts, var, tetap;
for(int i=0;i<2;i++)
{
//input data
cout<<"\nNama mhs = "; cin>>bayar[i].nama;
cout<<"NIM = "; cin>>bayar[i].nim;
cout<<"Jurusan[TI, MI, SI] = "; cin>>bayar[i].jurusan;
input:
cout<<"Program[1=D3, 2=S1] = "; cin>>bayar[i].program;
if(bayar[i].program<0||bayar[i].program>2)
{
cout<<"Program tidak sesuai\n";
goto input;
}
cout<<"Jumlah sks = "; cin>>bayar[i].sks;
if(bayar[i].program==1)
{
tetap=500000;
var=bayar[i].sks*25000;
}
else if(bayar[i].program==2)
{
tetap=750000;
var=bayar[i].sks*50000;
}
cout<<"";
//output data
cout<<"\n\n--------------------------\n";
cout<<" Output ";
cout<<"\n--------------------------\n";
cout<<"\nNama mhs = "<<bayar[i].nama;
cout<<"\nNIM = "<<bayar[i].nim;
cout<<"\nJurusan = "<<bayar[i].jurusan;
cout<<"\nProgram = "<<bayar[i].program;
cout<<"\nJumlah sks = "<<bayar[i].sks;
cout<<"\nSpp tetap = "<<tetap;
cout<<"\nSpp variabel ="<<var;
cout<<endl<<endl;
}
getch();
}