Kamis, 12 April 2012

INPUT NILAI C++


 #include <conio.h>
#include <iostream.h>
#include <stdio.h>
#include <fstream.h>
#include <process.h>
#include <iomanip.h>
main ()
{
int mid,uas,tgs,q,a,na,bn;
char n(10);
char nm(30);
char nh(2);
atas:
clrscr();
cout << "PROGRAM NILLAI \n";
cout << "================================ \n ";
cout <<"Masukan NIM :  ";
cin >> n;
cout <<"Masukkan NAMA :  ";
cin >> nm;
cout <<"Masukan Nilai MID :  ";
cin >> mid;
cout <<"Masukkan Nilai UAS :  ";
cin >> uas;
cout <<"Masukan Nilai Tugas :  ";
cin >> tgs;
cout <<"Masukkan Nilai Quis :  ";
cin >> q;
cout <<"Masukan Nilai Absensi :  ";
cin >> a;
na=(0.3*mid)+(0.3*uas)+(0.2*tgs)+(0.1*q)+(0.1*a);
cout<<"            Nilai Akhir : "<<na<<"\n";

if (na>=80)
{
nh='A';
bn=4;
//ket='Lulus';
}
if (na>=65)
{
nh='B';
bn=3;
//ket='Lulus';
}
else if (na>=55)
{
nh='C';
bn=2;
//ket='Lulus';
}

else if (na>=45)
{
nh='D';
bn=1;
//ket='Gagal';
}
else
{
nh='D';
bn=0;
//ket='Gagal';
}




 //cout<<setprecision(6);
cout<<"            Nilai Huruf : "<<nh<<"\n";
cout<<"            Bobot Nilai : "<<bn<<"\n";

if ((nh == 'A') | (nh=='B') |(nh=='C'))
{
cout<<"            Keterangan : Lulus""\n";
}
else
{
cout<<"            Keterangan : Gagal""\n";
}




getch();
}

Tidak ada komentar: