Borland C++ Tipe D


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
char *grade(char total)
{
if(total>80)
{return “A”;}
else if(total>70)
{return “B”;}
else if(total>60)
{return “C”;}
else if(total>50)
{return “D”;}
else
{return “E”;}
}
char *makul(char kode[4])
{
if(!strcmp(kode, “151”))
{return “Algoritma dan Pemrogrman 1”;}
else if(!strcmp(kode, “422”))
{return “linux 1”;}
else if(!strcmp(kode, “733”))
{return “PPN II(Access)”;}
else if(!strcmp(kode, “772”))
{return “DBMS”;}
}
main()
{
struct
{
char nim[8],nm[20];
int presen,tugas,uts,uas,total;
}nilai[10];
int i,j;
char kode[4];
clrscr();
cout<<“==========================================”<<endl;
cout<<”     PROGRAM HITUNG NILAI “<<endl;
cout<<“==========================================”<<endl;
cout<<“Kode Mata Kuliah       :”;cin>>kode;
cout<<“Jumlah Data Mahaasiswa :”;cin>>j;
for(i=1;i<=j;i++)
{
cout<<endl;
cout<<“Data Ke -“<<i<<endl;
cout<<“NIM     :”;cin>>nilai[i].nim;
cout<<“Nama    :”;cin>>nilai[i].nm;
cout<<“Nilai Presen1 :”;cin>>nilai[i].presen;
cout<<“Nilai Tugas   :”;cin>>nilai[i].tugas;
cout<<“Nilai UTS     :”;cin>>nilai[i].uts;
cout<<“Nilai UAS     :”;cin>>nilai[i].uas;
nilai[i].total=(0.1*nilai[i].presen)+(0.2*nilai[i].tugas)+(0.3*nilai[i].uts)+(0.4*nilai[i].uas);
}

clrscr();
cout<<“Kode Mata Kuliah        :”<<kode<<endl;
cout<<“Mata Kuliah             :”<<makul(kode)<<endl;
cout<<“===========================================================================”<<endl;
cout<<“No.|NIM    |Nama        |                 Nilai           |Total   |Grade”<<endl;
cout<<”   |       |Mahasiswa   | Presentasi1 | Tugas | UTS | UAS |”<<endl;
cout<<“===========================================================================”<<endl;
for(i=1;i<=j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(8)<<nilai[i].nim;
cout<<setiosflags(ios::left)<<setw(14)<<nilai[i].nm;
cout<<setiosflags(ios::left)<<setw(14)<<nilai[i].presen;
cout<<setiosflags(ios::left)<<setw(8)<<nilai[i].tugas;
cout<<setiosflags(ios::left)<<setw(6)<<nilai[i].uts;
cout<<setiosflags(ios::left)<<setw(5)<<nilai[i].uas;
cout<<setiosflags(ios::left)<<setw(9)<<nilai[i].total;
cout<<setiosflags(ios::left)<<setw(5)<<grade(nilai[i].total)<<endl;
}
cout<<“==========================================================================”<<endl;
//cout<<”                        Jumlah Mahasiswa Lulus : “<< <<endl;
//cout<<”                 Jumlah Mahasiswa Tidak Lulus  : “<< <<endl;
getch();
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: