#include<iostream.h>
#include<conio.h>
// Kelompok :
// Khoirul As'Ari (120 103 119 )
// Imron Amrullah
// Supardi
// Ibnu Tantowi
// Setyawan Febri
class makhluk
{
public:
void berkembang();
};
class hewan :
public makhluk
{
public:
void bergerak();
};
class kuda :
public hewan
{
public:
void berlari();
};
main()
{
makhluk mk; hewan hw; kuda kd;
cout<<endl<<"Sifat-sifat dari Makhluk adalah :"<<endl;
mk.berkembang();
cout<<endl<<"Sifat-sifat dari Hewan adalah :"<<endl;
hw.berkembang(); hw.bergerak();
cout<<endl<<"Sifat-sifat dari Kuda adalah :"<<endl;
mk.berkembang(); hw.bergerak(); kd.berlari();
getch();
}
void makhluk::berkembang()
{
cout<<"Berkembang biak"<<endl;
}
void hewan::bergerak()
{
cout<<"Bergerak berpindah tempat"<<endl;
}
void kuda::berlari()
{
cout<<"Berlari"<<endl;
}
Senin, 09 Desember 2013
Senin, 21 Oktober 2013
Coding "PROGRAM APLIKASI FUNGSI MENGHITUNG LUAS"
#include <conio.h>
void lingkaran ()
{
float r, L;
cout<<"Masukkan jari-jari : ";
cin>>r;
cout<<endl;
L = 3.14 * r * r;
cout<<"Luasnya adalah : "<< L;
};
void segiempat ()
{
float s, L;
cout<<"Masukkan sisi : ";
cin>>s;
cout<<endl;
L= s * s;
cout<<"Luasnya adalah : "<< L;
};
void segitiga ()
{
float a, t, s, r, L;
cout<<"Masukkan alas : ";
cin>>a;
cout<<endl;
cout<<"Masukkan tinggi : ";
cin>>t;
cout<<endl;
L = 0.5 * a * t;
cout<<"Luasnya adalah : "<< L;
};
void persegi_panjang ()
{
float p,l, L;
cout<<"Masukkan panjang : ";
cin>>p;
cout<<endl;
cout<<"Masukkan lebar : ";
cin>>l;
cout<<endl;
L = p * l;
cout<<"Luasnya adalah : "<< L;
};
void main ()
{
float a, t, L;
int pil;
cout<<"==========================================="<<endl;
cout<<" PROGRAM APLIKASI FUNGSI MENGHITUNG LUAS "<<endl;
cout<<" KHOIRUL AS'ARI_ 120 103 119 "<<endl;
cout<<"==========================================="<<endl;
cout<<endl;
cout<<"1. Luas Lingkaran"<<endl;
cout<<"2. Luas Segiempat"<<endl;
cout<<"3. Luas Segitiga"<<endl;
cout<<"4. Luas Persegi_Panjang"<<endl;
cout<<endl;
cout<<"Ketik pilihan anda (1/2/3) : ";
cin>>pil;
cout<<endl<<endl;
if (pil==1){lingkaran ();}
else if (pil==2){segiempat ();}
else if (pil==3){segitiga ();}
else if (pil==4){persegi_panjang ();}
getch();
}
Senin, 30 September 2013
Coding PBO Perulangan Dengan menggunakan ( for, do while dan while )
#include<iostream.h>
#include<conio.h>
void main()
{
int a;
cout<<"===============================================";
cout<<endl;
cout<<"PERRULANGAN BILANGAN DARI ANGKA DARI 1 SAMPAI 10";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan 1-10";
cout<<endl;
a=0;
do
{
a++;
cout<<","<<a;
}
while (a<10);
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan bilangan genap";
cout<<endl;
a=0;
do
{
a+=2;
cout<<","<<a;
}
while (a<10);
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan bilangan ganjil";
cout<<endl;
a=-1;
do
{
a+=2;
cout<<","<<a;
}
while (a<9);
cout<<endl;
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan 1-10";
cout<<endl;
cout<<endl;
for (a=1;a<=10;a++)
{
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan genap";
cout<<endl;
for (a=1;a<10;a++)
{
a+=1;
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan ganjil";
cout<<endl;
for (a=-1;a<9;)
{
a+=2;
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan 1-10";
cout<<endl;
cout<<endl;
a=1;
while(a<=10)
{
cout<<","<<a;
a++;
}
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan genap";
cout<<endl;
a=2;
while(a<=10)
{
cout<<","<<a;
a+=2;
}
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan ganjil";
cout<<endl;
a=1;
while(a<10)
{
cout<<","<<a;
a+=2;
}
getch();
}
#include<conio.h>
void main()
{
int a;
cout<<"===============================================";
cout<<endl;
cout<<"PERRULANGAN BILANGAN DARI ANGKA DARI 1 SAMPAI 10";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan 1-10";
cout<<endl;
a=0;
do
{
a++;
cout<<","<<a;
}
while (a<10);
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan bilangan genap";
cout<<endl;
a=0;
do
{
a+=2;
cout<<","<<a;
}
while (a<10);
cout<<endl;
cout<<endl;
cout<<"do_while_perulangan bilangan ganjil";
cout<<endl;
a=-1;
do
{
a+=2;
cout<<","<<a;
}
while (a<9);
cout<<endl;
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan 1-10";
cout<<endl;
cout<<endl;
for (a=1;a<=10;a++)
{
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan genap";
cout<<endl;
for (a=1;a<10;a++)
{
a+=1;
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"for_perulangan bilangan ganjil";
cout<<endl;
for (a=-1;a<9;)
{
a+=2;
cout<<","<<a;
}
cout<<endl;
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<"===============================================";
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan 1-10";
cout<<endl;
cout<<endl;
a=1;
while(a<=10)
{
cout<<","<<a;
a++;
}
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan genap";
cout<<endl;
a=2;
while(a<=10)
{
cout<<","<<a;
a+=2;
}
cout<<endl;
cout<<endl;
cout<<"while_perulangan bilangan ganjil";
cout<<endl;
a=1;
while(a<10)
{
cout<<","<<a;
a+=2;
}
getch();
}
Coding PBO_ Menghitung Tinggi badan dan Luas Lingkaran
#include <conio.h>
void main()
{ int kode; //tampilan utama
cout<<"|*****************************************|"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"| Nama : Khoirul As Ari |"<<endl;
cout<<"| Nim : 120103119 |"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"| PROGRAM PERHITUNGAN |"<<endl;
cout<<"|=========================================|"<<endl;
cout<<"| PILIHAN KODE |"<<endl;
cout<<"|=========================================|"<<endl;
cout<<"|1. Menghitung luas lingkaran |"<<endl;
cout<<"|2. Menghitung ukuran tinggi badan |"<<endl;
cout<<"|=========================================|"<<endl;
cout<<"MASUKKAN PILIHAN ANDA :";cin>>kode; //pemasukan kode
if (kode==1)
{
clrscr();
float j,luas; //penghitungan luas lingkaran
cout<<"|*****************************************|"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"| Nama : Khoirul As Ari |"<<endl;
cout<<"| Nim : 120103119 |"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"| MENGHITUNG LUAS LINGKARAN |"<<endl;
cout<<"|=========================================|"<<endl;
cout<<"MASUKKAN JARI-JARI :";cin>>j;
luas=3.14*j*j;
cout<<luas;
}
else if (kode==2)
{
clrscr();
int u; //penentuan ukuran badan
cout<<"|*****************************************|"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"| Nama : Khoirul As Ari |"<<endl;
cout<<"| Nim : 120103119 |"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"|*****************************************|"<<endl;
cout<<"| MENENTUKAN UKURAN BADAN ANDA |"<<endl;
cout<<"|=========================================|"<<endl;
cout<<"MASUKKAN UKURAN BADAN ANDA :";cin>>u;
if (u>=180)
{
cout<<"ANDA MEMILIKI UKURAN BADAN YANG TINGGI";
}
else if (u>=155&&u<=179)
{
cout<<"ANDA MEMILIKI UKURAN BADAN YANG SEDANG";
}
else if (u<155)
{
cout<<"ANDA MEMILIKI UKURAN BADAN YANG RENDAH";
}
}
else //jika kode yang dimasukkan salah
{
cout<<"\nMaaf kode yang anda masukkan salah..!!"<<endl<<endl;
}
getch();
}
Algoritma Pengurangan dan Penjumlahan Matriks
Algoritma Pengurangan Matriks
Deklarasi
i, j: integer
Deskripsi
for<-- i to baris do
for<-- j to baris do
kurang[i,j]:= matriks1[i,j] - matriks2 [i.j]
end for
end for
Source code:
#include <iostream.h>
#include <conio.h>
void baca(int mat[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
cout<<"Data ["<<i+1<<" , "<<j+1<<"] : ";
cin>>mat[i][j];}
}
void kurangM(const int matriks1[10][10], const int matriks2[10][10], int baris, int kolom, int hasil[10][10]){
int i,j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]= matriks1[i][j]- matriks2[i][j];
}
void cetak(int A[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++){
for (j=0; j<kolom; j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
}
int main(){
int b,k;
int matriks1[10][10], matriks2[10][10];
int hasil[10][10];
cout<<"Banyak Baris: "; cin>>b;
cout<<"Banyak kolom: "; cin>>k;
cout<<"\nMatriks Pertama \n";
baca(matriks1, b, k);
cetak(matriks1, b, k);
cout<<"\nMatriks Kedua \n";
baca(matriks2, b, k);
cetak(matriks2, b, k);
kurangM(matriks1, matriks2, b, k, hasil);
cout<<"\nHasil pengurangan \n";
cetak(hasil, b, k);
getch();
}
i, j: integer
Deskripsi
for<-- i to baris do
for<-- j to baris do
kurang[i,j]:= matriks1[i,j] - matriks2 [i.j]
end for
end for
Source code:
#include <iostream.h>
#include <conio.h>
void baca(int mat[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
cout<<"Data ["<<i+1<<" , "<<j+1<<"] : ";
cin>>mat[i][j];}
}
void kurangM(const int matriks1[10][10], const int matriks2[10][10], int baris, int kolom, int hasil[10][10]){
int i,j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]= matriks1[i][j]- matriks2[i][j];
}
void cetak(int A[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++){
for (j=0; j<kolom; j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
}
int main(){
int b,k;
int matriks1[10][10], matriks2[10][10];
int hasil[10][10];
cout<<"Banyak Baris: "; cin>>b;
cout<<"Banyak kolom: "; cin>>k;
cout<<"\nMatriks Pertama \n";
baca(matriks1, b, k);
cetak(matriks1, b, k);
cout<<"\nMatriks Kedua \n";
baca(matriks2, b, k);
cetak(matriks2, b, k);
kurangM(matriks1, matriks2, b, k, hasil);
cout<<"\nHasil pengurangan \n";
cetak(hasil, b, k);
getch();
}
Algoritma Penjumlahan Matriks
Deklarasi
i, j: integer
Deskripsi
for<-- i to baris do
for<-- j to baris do
jumlah[i,j]:= matriks1[i,j] + matriks2 [i.j]
end for
end for
Source code:
#include <iostream.h>
#include <conio.h>
void baca(int mat[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
cout<<"Data ["<<i+1<<" , "<<j+1<<"] : ";
cin>>mat[i][j];}
}
void jumlahM(const int matriks1[10][10], const int matriks2[10][10], int baris, int kolom, int hasil[10][10]){
int i,j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]= matriks1[i][j]+ matriks2[i][j];
}
void cetak(int A[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++){
for (j=0; j<kolom; j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
}
int main(){
int b,k;
int matriks1[10][10], matriks2[10][10];
int hasil[10][10];
cout<<"Banyak Baris: "; cin>>b;
cout<<"Banyak kolom: "; cin>>k;
cout<<"\nMatriks Pertama \n";
baca(matriks1, b, k);
cetak(matriks1, b, k);
cout<<"\nMatriks Kedua \n";
baca(matriks2, b, k);
cetak(matriks2, b, k);
jumlahM(matriks1, matriks2, b, k, hasil);
cout<<"\nHasil penjumlahan \n";
cetak(hasil, b, k);
getch();
}
Penjelasannya Penjumlahan Matriks :
inti dari program ini sebenarnyab terletak di
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]= matriks1[i][j]+ matriks2[i][j];
karena disinilah program akan menjumlahkan inputan kita....
satu hal yang harus diketahui adalah agar bisa menjumlahkan Matriks adalah jumlah baris dan kolom antara matriks 1 dan matriks ke dua haruslah sama. OK....
i, j: integer
Deskripsi
for<-- i to baris do
for<-- j to baris do
jumlah[i,j]:= matriks1[i,j] + matriks2 [i.j]
end for
end for
Source code:
#include <iostream.h>
#include <conio.h>
void baca(int mat[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
cout<<"Data ["<<i+1<<" , "<<j+1<<"] : ";
cin>>mat[i][j];}
}
void jumlahM(const int matriks1[10][10], const int matriks2[10][10], int baris, int kolom, int hasil[10][10]){
int i,j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]= matriks1[i][j]+ matriks2[i][j];
}
void cetak(int A[10][10], int baris, int kolom){
int i, j;
for (i=0; i<baris; i++){
for (j=0; j<kolom; j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
}
int main(){
int b,k;
int matriks1[10][10], matriks2[10][10];
int hasil[10][10];
cout<<"Banyak Baris: "; cin>>b;
cout<<"Banyak kolom: "; cin>>k;
cout<<"\nMatriks Pertama \n";
baca(matriks1, b, k);
cetak(matriks1, b, k);
cout<<"\nMatriks Kedua \n";
baca(matriks2, b, k);
cetak(matriks2, b, k);
jumlahM(matriks1, matriks2, b, k, hasil);
cout<<"\nHasil penjumlahan \n";
cetak(hasil, b, k);
getch();
}
Penjelasannya Penjumlahan Matriks :
inti dari program ini sebenarnyab terletak di
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++)
hasil[i][j]= matriks1[i][j]+ matriks2[i][j];
karena disinilah program akan menjumlahkan inputan kita....
satu hal yang harus diketahui adalah agar bisa menjumlahkan Matriks adalah jumlah baris dan kolom antara matriks 1 dan matriks ke dua haruslah sama. OK....
Algoritma Perkalian Matriks
Algoritma:
deklarasi
i, j, k; int
deskripsi
for<-- i to baris do
for<-- j to baris do
mat_kali[i][j] = 0
for k <-- 1 to barkol do
mat_kali[i][j]<-- mat_kali[i][j] + matriks1[i][k] * matriks2[k][j]
end for
end for
end for
Source code:
#include <iostream.h>
#include <conio.h>
void baca(int mat[10][10], int baris, int kolom){
int i,j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
cout<<"Data ["<<i+1<<","<<j+1<<"] : ";
cin>>mat[i][j];}
}
void kali(const int M1[10][10], const int M2[10][10], int baris, int kolom, int barkol, int hasil[10][10]){
int i, j, k;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
hasil[i][j]=0;
for (k=0; k<barkol; k++)
hasil[i][j]=hasil[i][j] +M1[i][k] *M2[k][j];}
}
void cetak(const int A[10][10], int baris, int kolom){
int i,j;
for (i=0; i<baris; i++){
for (j=0; j<kolom; j++)
cout<<A[i][j]<<" ";
cout<<endl;}
}
int main(){
int a,b,c;
int M1[10][10], M2[10][10];
int hasil[10][10];
cout<<"banyak baris matriks 1 : "; cin>>a;
cout<<"banyak kolom matriks 2 : "; cin>>b;
cout<<"banyak kolom matriks 1 atau baris matriks 2 : "; cin>>c;
cout<<"\nMatriks pertama \n";
baca(M1, a, c); cout<<endl;
cetak(M1, a, c);
cout<<"\nMatriks Kedua \n";
baca(M2, c, b); cout<<endl;
cetak(M2, c, b);
kali(M1, M2, a, b, c, hasil);
cout<<"\nHasil Perkalian \n";
cetak(hasil , a, b);
getch();
}
Penjelasannya:
inti dari program ini terletak di fungsi void kali.....
dan dalam hal mengalikan matriks ini teman-teman harus mengetahui syarat perkalian matriks terlebih dahulu. yaitu jumlah kolom mtriks pertama harus sama dengan jumlah baris matriks ke dua.Jadi dalam hal ini saya belum menggunakan fungsi if, tapi saya langsung menginputkan nya menjadi satu. Dapat teman liat sendiri di
" cout<<"banyak kolom matriks 1 atau baris matriks 2 : "; cin>>c; ".. Ok...
deklarasi
i, j, k; int
deskripsi
for<-- i to baris do
for<-- j to baris do
mat_kali[i][j] = 0
for k <-- 1 to barkol do
mat_kali[i][j]<-- mat_kali[i][j] + matriks1[i][k] * matriks2[k][j]
end for
end for
end for
Source code:
#include <iostream.h>
#include <conio.h>
void baca(int mat[10][10], int baris, int kolom){
int i,j;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
cout<<"Data ["<<i+1<<","<<j+1<<"] : ";
cin>>mat[i][j];}
}
void kali(const int M1[10][10], const int M2[10][10], int baris, int kolom, int barkol, int hasil[10][10]){
int i, j, k;
for (i=0; i<baris; i++)
for (j=0; j<kolom; j++){
hasil[i][j]=0;
for (k=0; k<barkol; k++)
hasil[i][j]=hasil[i][j] +M1[i][k] *M2[k][j];}
}
void cetak(const int A[10][10], int baris, int kolom){
int i,j;
for (i=0; i<baris; i++){
for (j=0; j<kolom; j++)
cout<<A[i][j]<<" ";
cout<<endl;}
}
int main(){
int a,b,c;
int M1[10][10], M2[10][10];
int hasil[10][10];
cout<<"banyak baris matriks 1 : "; cin>>a;
cout<<"banyak kolom matriks 2 : "; cin>>b;
cout<<"banyak kolom matriks 1 atau baris matriks 2 : "; cin>>c;
cout<<"\nMatriks pertama \n";
baca(M1, a, c); cout<<endl;
cetak(M1, a, c);
cout<<"\nMatriks Kedua \n";
baca(M2, c, b); cout<<endl;
cetak(M2, c, b);
kali(M1, M2, a, b, c, hasil);
cout<<"\nHasil Perkalian \n";
cetak(hasil , a, b);
getch();
}
Penjelasannya:
inti dari program ini terletak di fungsi void kali.....
dan dalam hal mengalikan matriks ini teman-teman harus mengetahui syarat perkalian matriks terlebih dahulu. yaitu jumlah kolom mtriks pertama harus sama dengan jumlah baris matriks ke dua.Jadi dalam hal ini saya belum menggunakan fungsi if, tapi saya langsung menginputkan nya menjadi satu. Dapat teman liat sendiri di
" cout<<"banyak kolom matriks 1 atau baris matriks 2 : "; cin>>c; ".. Ok...
Jumat, 27 September 2013
Coding Program Aplikasi KHS ( Kartu Hasil Study )_mata Kuliah Algoritma Pemrograman_Semester 2
Source
Code Program Aplikasi KHS ( Kartu Hasil Study )
#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<iomanip.h>
main()
{
class
{
public:
char nim[8],nama[20];
int semester,j;
}mahasiswa;
class
{
public:
char *grade,matkul[20];
long sks,absen,tugas,uts,uas,akhir,mutu,jumlah;
}nilai[100];
int i;
float
totalmutu=0,totalsks=0,ips;
clrscr();
cout<<" STMIK
DUTA BANGSA SURAKARTA"<<endl;
cout<<"--------------------------------------------------"<<endl;
cout<<"Pengolahan
Data KHS Mahasiswa"<<endl;
cout<<"Nomor
Induk Mahasiswa : ";gets(mahasiswa.nim);
cout<<"Nama
Mahasiswa : ";gets(mahasiswa.nama);
cout<<"Semester
: ";cin>>mahasiswa.semester;
cout<<"Jumlah
Mata Kuliah : ";cin>>mahasiswa.j;
cout<<"--------------------------------------------------"<<endl;
for(i=1;i<=mahasiswa.j;i++)
{
cout<<"Data
Mahasiswa Ke - "<<i<<endl;
cout<<"Nama
Mata Kuliah : ";gets(nilai[i].matkul);
cout<<"Jumlah
SKS : ";cin>>nilai[i].sks;
cout<<"Nilai
Absen : ";cin>>nilai[i].absen;
cout<<"Nilai
Tugas : ";cin>>nilai[i].tugas;
cout<<"Nilai
UTS : ";cin>>nilai[i].uts;
cout<<"Nilai
UAS : ";cin>>nilai[i].uas;
cout<<"---------------------------------------------------"<<endl;
nilai[i].akhir=(0.1*nilai[i].absen)+(0.2*nilai[i].tugas)+(0.3*nilai[i].uts)+(0.4*nilai[i].uas);
if(nilai[i].akhir>=80)
{nilai[i].grade="A";nilai[i].mutu=4;}
else
if(nilai[i].akhir>=70)
{nilai[i].grade="B";nilai[i].mutu=3;}
else
if(nilai[i].akhir>=60)
{nilai[i].grade="C";nilai[i].mutu=2;}
else
if(nilai[i].akhir>=50)
{nilai[i].grade="D";nilai[i].mutu=1;}
else
{nilai[i].grade="E";nilai[i].mutu=0;}
nilai[i].jumlah=nilai[i].sks+nilai[i].mutu;
totalmutu=totalmutu+nilai[i].jumlah;
totalsks=totalsks+nilai[i].sks;
}
ips=totalmutu/totalsks;
clrscr();
cout<<"
AKADEMI GLOBE GREEN"<<endl;
cout<<" Kartu
Hasil Studi (KHS)"<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<"Nomor
Induk Mahasiswa : "<<mahasiswa.nim<<endl;
cout<<"Nama
Mahasiswa : "<<mahasiswa.nama<<endl;
cout<<"Semester
: "<<mahasiswa.semester<<endl;
cout<<"Jumlah
Mata Kuliah : "<<mahasiswa.j<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<"No Nama
Mata Kuliah SKS Nilai Akhir Grade Nilai Mutu Jumlah Mutu"<<endl;
cout<<"-------------------------------------------------------------------------"<<endl;
for(i=1;i<=mahasiswa.j;i++)
{
cout<<setiosflags(ios::left)<<setw(4)<<i;
cout<<setiosflags(ios::left)<<setw(18)<<nilai[i].matkul;
cout<<setiosflags(ios::left)<<setw(15)<<nilai[i].sks;
cout<<setiosflags(ios::left)<<setw(10)<<nilai[i].akhir;
cout<<setiosflags(ios::left)<<setw(10)<<nilai[i].grade;
cout<<setiosflags(ios::left)<<setw(10)<<nilai[i].mutu;
cout<<setiosflags(ios::left)<<setw(20)<<nilai[i].jumlah<<endl;
}
cout<<"-------------------------------------------------------------------------"<<endl;
cout<<" Total
Mutu : "<<totalmutu<<endl;
cout<<" Total
SKS : "<<totalsks<<endl;
cout<<" Indeks
Prestasi Semester (IPS) : "<<ips<<endl;
getch();
}
Langganan:
Postingan (Atom)