funika

Wednesday, 23 December 2015

Menampilkan Daftar Nilai Ujian Menggunakan Program C

Menampilkan Daftar Nilai Ujian Program C

    
ini adalah contoh Program dengan penggunaan matrix ;

#include <stdio.h>
#include <conio.h>
void main()
{
char pr[4][25]={"Bisnis Administrasi","Sekretaris","Informatika Komputer","Komputer Akuntansi"};
int rjm[4][2]={0,0,0,0,0,0,0,0};
char nama[5][20]={"Andika","Andina","Evi","Rony","Masria"};
int data[5][6]={0,60,70,80,76,80,2,70,78,65,67,78,3,60,75,85,75,80,1,77,76,85,87,88,0,60,70,80,76,80};
int i,na,k,n;

clrscr();
printf("\n              DAFTAR NILAI AKHIR");
printf("\n------------------------------------------------");
printf("\n No Nama Mahasiswa  Program  Nilai  Keterangan");
printf("\n------------------------------------------------\n");
n=0;
for(i=0;i<=4;i++)
{n++;
 na=0.1*data[i][1]+0.1*0.1*data[i][2]+0.2*data[i][3];
 na=na+0.25*data[i][4]+0.35*data[i][5];
 k=data[i][0];
 rjm[k][0]=rjm[k][0]+1;
gotoxy(2,6+i);printf("%i",n);
gotoxy(6,6+i);printf("%s",nama[i]);
gotoxy(22,6+i);printf("%s",pr[k]);
gotoxy(45,6+i);printf("%i",na);

if(na>=70)
   {gotoxy(51,6+i);printf("LULUS");
   rjm[k][1]=rjm[k][i]+1;}
else if(na>=60)
   {gotoxy(51,6+i);printf("HER");}
else{gotoxy(51,6+i);printf("GAGAL");}
}
gotoxy(1,6+i);printf("\n---------------------------------");
printf("\n");
printf("\nREKAPITULASI JUMLAH MAHASISWA");
printf("\n-----------------------------------------------");
printf("\nProgram               Jumlah Siswa Lulus");
printf("\n-----------------------------------------------");
for(i=0;i<=3;i++)
{gotoxy(1,18+i);printf("%s",pr[i]);
gotoxy(25,18+i);printf("%i",rjm[i][0]);
gotoxy(35,18+i);printf("%i",rjm[i][1]);
}
printf("\n-----------------------------------------------");
getch();
}

No comments :

Post a Comment