Kali ini saya akan memberikan contoh scrip Kartu Hasil Mahasiswa(Nilai Akhir) pada Borland C++ di dalam program menggunakan If Else.
Silahkan Salin Scrip yang di bawah untuk di Pelajari.
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
void main ()
{
char nim[20],nama[20],jurusan[20],kelas[20];
float UAS,UTS,Tugas,absen,R;
cout<<" Kartu Hasil Mahasiswa"<<endl;
cout<<" Bina Sarana Informatika"<<endl;
cout<<"======================================="<<endl;
cout<<"============DATA MAHASISWA============="<<endl;
cout<<" NIM Mahasiswa :";
cin>>nim;
cout<<" Nama Mahasiswa :";
gets(nama);
cout<<" Jurusan :";
cin>>jurusan;
cout<<" Kelas :";
cin>>kelas;
cout<<"==========================="<<endl;
cout<<"===DATA NILAI MAHASISWA==="<<endl;
cout<<"**************************"<<endl;
cout<<" Nilai Absen :";
cin>>absen;
cout<<" Nilai Tugas :";
cin>>Tugas;
cout<<" Nilai UTS :";
cin>>UTS;
cout<<" Nilai UAS :";
cin>>UAS;
R= 0.1*absen+0.4*UAS+0.3*UTS+0.2*Tugas;
cout<<"============================"<<endl;
cout<<"==========HASIL AKHIR======="<<endl;
cout<<" NIlai Akhir :"<<R<<endl;
if (R>60)
{
cout<<" Keterangan :LULUS";
}
else
{
cout<<" Keterangan :TIDAK LULUS";
}
getch();
}
#include<conio.h>
#include<iostream.h>
void main ()
{
char nim[20],nama[20],jurusan[20],kelas[20];
float UAS,UTS,Tugas,absen,R;
cout<<" Kartu Hasil Mahasiswa"<<endl;
cout<<" Bina Sarana Informatika"<<endl;
cout<<"======================================="<<endl;
cout<<"============DATA MAHASISWA============="<<endl;
cout<<" NIM Mahasiswa :";
cin>>nim;
cout<<" Nama Mahasiswa :";
gets(nama);
cout<<" Jurusan :";
cin>>jurusan;
cout<<" Kelas :";
cin>>kelas;
cout<<"==========================="<<endl;
cout<<"===DATA NILAI MAHASISWA==="<<endl;
cout<<"**************************"<<endl;
cout<<" Nilai Absen :";
cin>>absen;
cout<<" Nilai Tugas :";
cin>>Tugas;
cout<<" Nilai UTS :";
cin>>UTS;
cout<<" Nilai UAS :";
cin>>UAS;
R= 0.1*absen+0.4*UAS+0.3*UTS+0.2*Tugas;
cout<<"============================"<<endl;
cout<<"==========HASIL AKHIR======="<<endl;
cout<<" NIlai Akhir :"<<R<<endl;
if (R>60)
{
cout<<" Keterangan :LULUS";
}
else
{
cout<<" Keterangan :TIDAK LULUS";
}
getch();
}
0 komentar:
Posting Komentar