College Student
Bibi is a lecturer who manages a student database at a university. Before Bibi existed, the student database was not well organized, and was not collected per student, so student's data could be chopped up and scattered irregularly between one another.
Because Bibi is a lecturer who has studied ”struct”, Bibi wants to store all the data given in the struct. Making it easier to find and reuse.
Data from students can contain:
• Name (Nama)
• NIM
• Age (Umur)
• Postal Code (Kode Pos)
• Place of Birth (POB / Tempat Lahir)
• Date of Birth (DOB / Tanggal Lahir)
• High School (Almamater SMA)
• Number of Siblings (Jumlah Saudara Kandung)
• Height (Tinggi Badan)
• Bank Account Number (NOMOR REKENING)
Format Input
The input in the first row contains an integer N, how much student data you have to save. For the next N x 10 rows of student data you must save sequentially from the Name until Account Number.
Format Output
The output consists of (N x 10) + N lines. Student data is preceded by ”Mahasiswa ke-X:”, where X is the order of students.
Sample Input (standard input)
2
Lili
123456789
13
786431
Jakarta
14 SEPT2010
Bina Nusantara School
7
123
968543769
Jojo
125676789
22
711111
Bekasi
1 JANUARY2018
Bina Nusantara School
99
12
890234789
Sample Output (standard output)
Mahasiswa ke-1:
Nama : Lili
NIM : 123456789
Umur : 13
Kode Pos : 786431
Tempat Lahir : Jakarta
Tanggal Lahir : 14 SEPT2010
Almamater SMA : Bina Nusantara School
Jumlah Saudara Kandung : 7
Tinggi Badan : 123
NOMOR REKENING : 968543769
Mahasiswa ke-2:
Nama : Jojo
NIM : 125676789
Umur : 22
Kode Pos : 711111
Tempat Lahir : Bekasi
Tanggal Lahir : 1 JANUARY2018
Almamater SMA : Bina Nusantara School
Jumlah Saudara Kandung : 99
Tinggi Badan : 12
NOMOR REKENING : 890234789
Mahasiswa ke-1:
Nama:
NIM: Lili
Umur: 123456789
Kode Pos: 13
Tempat Lahir:
Tanggal Lahir:
Almamater SMA:
Jumlah Saudara Kandung: 786431
Tinggi Badan: 0
NOMOR REKENING: Jakarta
14 SEPT2010
Bina Nusantara School
Mahasiswa ke-2:
Nama:
NIM: 14
Umur: 123456789
Kode Pos: SEPT2010
Tempat Lahir:
Tanggal Lahir:
Almamater SMA:
Jumlah Saudara Kandung: 786431
Tinggi Badan: 0
NOMOR REKENING: Bina
2. Use -Wall (or equivalent) when you compile your code.
Do NOT attempt to run code containing warnings, only to then ask "what's wrong"
1 2 3 4 5 6 7 8 9 10 11
$ gcc -Wall foo.c
foo.c: In function ‘main’:
foo.c:28:7: warning: too many arguments for format [-Wformat-extra-args]
scanf("[^\n]", mahasiswa.dob);
^
foo.c:32:7: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
scanf("%s", mahasiswa.bank);
^
foo.c:45:8: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
printf("NOMOR REKENING: %s\n", mahasiswa.bank);
^