View difference between Paste ID: rPm78XuB and jT1mahmP
SHOW: | | - or go back to the newest paste.
1
2
#include <stdio.h>
3
#include <string.h>
4
#include <stdlib.h>	
5
6
	struct mahasiswa{
7
	char nama[50];
8-
	}mhs[10];
8+
9
	}mhs[100];
10
		
11
int	n=0;
12
13
int main(){
14-
	mahasiswa mhs;
14+
15
	int menu;		
16
17
	do{
18
		
19
		printf("1.Insert\n");
20
		printf("2.View\n");
21
		printf("3.Exit\n");
22
		printf(" \n");
23
		scanf("%d",&menu);
24
		fflush(stdin);
25
	
26
27
		switch(menu){
28
29
		case 1:
30
			
31
			printf("Insert Name : ");
32
			scanf("%[^\n]",&mhs.nama);
33
			fflush(stdin);
34
			
35
			printf("Insert Nim : ");
36
			scanf("%[^\n]",&mhs.nim);
37
			fflush(stdin);
38
			break;
39
40
		case 2:
41
			for(int i=0; i<n; i++){
42
				printf("%d. %s - %s \n", i+1, mhs.nama[i], mhs.nim[i]);
43
			}
44
			break;
45
		}
46
	}while(menu !=3);
47
	
48
49
50
getchar();
51
return 0;
52
}