0% found this document useful (0 votes)
22 views2 pages

Contoh Array 2 Dimensi

The document describes a program for storing and outputting student grade data using a 2D array in C. It includes inputting student ID, name, courses, credits, and grades. It then outputs a results sheet showing this data for each student along with calculations for total credits, grade points, and GPA.

Uploaded by

inda store
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Contoh Array 2 Dimensi

The document describes a program for storing and outputting student grade data using a 2D array in C. It includes inputting student ID, name, courses, credits, and grades. It then outputs a results sheet showing this data for each student along with calculations for total credits, grade points, and GPA.

Uploaded by

inda store
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CONTOH PROGRAM ARRAY 2 DIMENSI

# include <stdio.h>
# include <conio.h>
# include <string.h>
# include <stdlib.h>
# define N 20
# define M 10

void main()
{
/* Dekrasi Variabel */
clrscr();
char nobp[N][8],nama[N][20];
char mk[N][M][25],sks[N][M][2];
char nilai[N][M];
int i=1,j,jmlmhs=0,jummk[N];
char lagi;

/* Input Data */
printf("\nINPUT NILAI MAHASISWA");
printf("\n=====================");

while(1)
{
printf("\n\nINPUT MAHASISWA KE : %d",i);
printf("\n=====================");
printf("\nNo Bp : "); gets(&nobp[i][0]);
printf("Nama Mahasiswa : "); gets(&nama[i][0]);
jummk[i]=0;
j=1;

while (1)
{
printf("\n\nINPUT NILAI MAHASISWA KE : %d",j);
printf("\n===========================");
printf("\nMata kuliah : "); gets(&mk[i][j][0]);
printf("SKS : "); gets(&sks[i][j][0]);
printf("Nilai : "); nilai[i][j]=getche();
jummk[i]=jummk[i]+1;
j++;

printf("\nADA MATA KULIAH LAGI :[Y/T]");


lagi=getche();
if (lagi=='T' || lagi=='t')
break;
}

i++;
jmlmhs=jmlmhs+1;
printf("\nADA MAHASISWA LAGI :[Y/T]");
lagi=getche();
if (lagi=='T' ||lagi=='t')
break;
}

/* Output Data */
clrscr();
printf("\nLEMBAR HASIL NILAI MAHASISWA");
printf("\n=============================\n");
for(i=1;i<=jmlmhs;i++)
{
printf("\n NOBP : %s",nobp[i]);
printf("\n NAMA : %s",nama[i]);
printf("\n =========================");
printf("\n Mata kuliah \t\tSKS \tNilai");
printf("\n ===========================");
for(j=1;j<=jummk[i];j++)
{
printf("\n%s \t%s \t%c",mk[i][j],sks[i][j],nilai[i][j]);
}
printf("\n");
}
getch();
}
HASIL :

TUGAS

Modifikasi Program di Atas, sehingga Output Tampilannya menjadi sbb :

LEMBAR HASIL STUDI MAHASISWA


STMIK JAYANUSA PADANG

No Bp : 0720001
Nama : Imam Gunawan
----------------------------------------------------
Matakuliah Sks Nilai Bobot Mutu Keterangan
----------------------------------------------------
Visual Basic 4 A 4 16 Lulus
Pancasila 2 D 1 2 Gagal
----------------------------------------------------
Total Sks : 6
Total Mutu : 18
Indeks Prestasi : 3,00

Ketentuan Proses:

1. Jika Nilai A Bobot 4, Nilai B Bobot 3, Nilai C Bobot 2, Nilai D


Bobot 1, Nilai E Bobot 0
2. Mutu = Sks * Bobot
3. Keterangan = jika nilai A,B dan C maka “LULUS” selain itu “GAGAL”.
4. Indeks Prestasi = Total Mutu / Total Sks
HASIL :

You might also like