PROGRAM INI MENCETAK STATUS HASIL KE-3 NILAI MAHASISWA

January 13, 2009 at 2:35 am (Konsep pemrograman, materi perkuliahan)

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

void masukkan(float*N1,float*N2,float*N3);
float hitung_rata(float N1,float N2,float nN3);
void cetak(char nama[20],float N1,float N2,float N3,char status[20]);
void bintang();
void penjelasan();

void main()
{
//deklarasi variable
char nama [20];
char status [20];
float N1,N2,N3,NR;
clrscr();

//baca input
penjelasan();
bintang();
cout<<“MASUKKAN NAMA MAHASISWA = “;
cin>>nama;

masukkan (&N1,&N2,&N3);
if((N1<60)||(N2<60)||(N3<60))
strcpy(status,”TIDAK LULUS”);
else
{
NR=hitung_rata(N1,N2,N3);
if(NR<70)
strcpy(status,”TIDAK LULUS”);
else
strcpy(status,”LULUS”);
}

//proses
bintang();
cetak(nama,N1,N2,N3,status);
bintang();
}

void masukkan(float*N1,float*N2,float*N3)
{
cout<<“MASUKKAN 3 NILAI UJIAN “<<endl;
cout<<“NILAI 1 = “;
cin>>*N1;
cout<<“NILAI 2 = “;
cin>>*N2;
cout<<“NILAI 3 = “;
cin>>*N3;
}

float hitung_rata(float N1, float N2, float N3)
{
float hasil;
hasil = (N1+N2+N3)/3;
N1= 90,N2=90,N3=90;
return(hasil);
}

void cetak(char nama[20],float N1,float N2,float N3,char status[20])
{
cout<<”                   HASIL PROGRAM  “<<endl;
bintang();
cout<<“NAMA    = “<<nama<<endl;
cout<<“NILAI 1 = “<<N1<<endl;
cout<<“NILAI 2 = “<<N2<<endl;
cout<<“NILAI 3 = “<<N3<<endl;
cout<<“STATUS  = “<<status<<endl;
bintang();

}

void bintang()
{
cout<<“**********************************************************************”<<endl;
}

void penjelasan()
{
bintang();
cout<<“PROGRAM INI MENCETAK STATUS HASIL KE-3 NILAI MAHASISWA”<<endl;
cout<<“DENGAN INPUT NAMA, NILAI 1, NILAI 2, NILAI 3″<<endl;
cout<<“NILAI RATA-RATA = (NILAI 1+NILAI 2+ NILAI 3)/3″<<endl;
bintang();
}

1 Comment

  1. dhika said,

    hehehehe
    hebat bgt

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: