-
Notifications
You must be signed in to change notification settings - Fork 0
/
sesmod4soal2.c
48 lines (43 loc) · 1.13 KB
/
sesmod4soal2.c
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
#include <stdio.h>
#include <string.h>
int main(){
struct mahasiswa{
char nama[100];
int mtk;
int ipa;
int bindo;
int bing;
};
int N;
scanf("%d", &N);
struct mahasiswa mhs[N];
for(int i=0; i<N; i++){
scanf("%s", mhs[i].nama);
scanf("%d", &mhs[i].mtk);
scanf("%d", &mhs[i].ipa);
scanf("%d", &mhs[i].bindo);
scanf("%d", &mhs[i].bing);
}
int cari;
scanf("%d", &cari);
char carinama[100];
for(int k=0; k<cari; k++){
scanf("%s", carinama);
int found = 0;
for(int i=0; i<N; i++){
if(strcmp(mhs[i].nama, carinama)==0){
printf("Nilai %s\n", mhs[i].nama);
printf("Matematika : %d\n", mhs[i].mtk);
printf("IPA : %d\n", mhs[i].ipa);
printf("Bahasa Indonesia : %d\n", mhs[i].bindo);
printf("Bahasa Inggris : %d\n", mhs[i].bing);
found = 1;
break;
}
}
if (!found) {
printf("Nilai %s tidak ditemukan\n", carinama);
}
}
return 0;
}