UAS, Nilai Akhir dengan C++
 
 
 

Dari pada disimpen anakan mening dishare (Aplikasi penentu nilai akhir dengan C++). sharing is sexy. yeuh:

#include<conio.h>
#include<iostream.h>

void garis();
float nilai_akhir(float a, float b, float c, float d);
char nilai_huruf(float a, float b, float c, float d);

main(){
	int b;
	char lagi;
	
	struct{
		char nama[20];
		float uts,uas,tm,ts;
	}
	a[100];

	do{
		clrscr();
		cout<<"banyaknya data yang akan diinputkan: "; 
		cin>>b;
		cout<<endl;

		for(int i=1; i<=b; i++){
			cout<<"inputkan nama mahasiswa : "; cin>>a[i].nama;
			cout<<"inputkan nilai tugas mandiri : "; cin>>a[i].tm;
			cout<<"inputkan nilai tugas terstruktur: "; cin>>a[i].ts;
			cout<<"inputkan nilai UTS : "; cin>>a[i].uts;
			cout<<"inputkan nilai UAS : "; cin>>a[i].uas;
			clrscr();
		}
		
		gotoxy(9,2);cout<<"#################################################################"<<endl;
		gotoxy(9,3);cout<<"# 																 #"<<endl;
		gotoxy(9,4);cout<<"# 				  Menentukan Nilai Akhir Mahasiswa 				 #"<<endl;
		gotoxy(9,5);cout<<"# 																 #"<<endl;
		gotoxy(9,6);cout<<"#################################################################"<<endl;
		garis();
		cout<<" No.| "<<"Nama"<<" | "<<"Nilai"<<" |"<<" Nilai"<<endl;
		cout<<" | "<<"Mahasiswa"<<" "<<"| TugasMandiri"<<" | "<<"TugasTerstruktur"<<" | "<<"UTS"<<" | "<<"UAS | "<<"Akhir | "<<"Huruf" <<endl;
		cout<<" ----------------------------------------------------------------------------"<<endl;
		for(int i=1; i<=b; i++){
			cout <<" "<<i<<"."<<" "<<a[i].nama<<" "<<a[i].tm<<" "<<a[i].ts<<" "<<a[i].uts<<" "<<a[i].uas;
			cout<<" "<< nilai_akhir(a[i].tm ,a[i].ts ,a[i].uts ,a[i].uas)<<" "<< nilai_huruf(a[i].tm ,a[i].ts ,a[i].uts ,a[i].uas)  <<endl;
		}
		garis();
		cout<<" ---------------------------inputkan data lagi[Y/T]: "; cin>>lagi;
	}
	while(lagi=='Y'||lagi=='y');

	getch();
}

void garis(){
	cout<<" ____________________________________________________________________________"  <<endl;
}

float nilai_akhir(float a,float b, float c,float d){
	float hasil;
	hasil=((a+b+c+(d*2))/5);
	return(hasil);
	
}

char nilai_huruf(float a,float b, float c,float d){
	float m;
	m=((a+b+c+(d*2))/5);

	if(85<m){
		return 'A';
	}else if(70<m&&m<=85){
		return 'B';
	}else if(65<m&&m<=70){
		return 'C';
	}else if(40<m&&m<=65){
		return 'D';
	}else if(0<m&&m<=40){
		return 'E';
	}else{
		return 'o';
	}
}

hasilna:

Kata kunci:

#

 


    Jadilah Orang Pertama yang Berkomentar!!!