Buatlah program menghitung nilai akhir perkuliahan pada suatu mata kuliah , dengan ketentuan sebagai berikut :
*Nilai Absensi * 10%
* Nilai Tugas * 20%
* Nilai U.T.S * 30%
* Nilai U.A.S * 40%
Untuk proses penilaian dilakukan di dalam file header dan simpan nama file header tersebut hitnilai.h
Buatlah program header di bawah ini , kemudian simpan dengan nama : hitnilai.h , pada folder kerja anda folder include
/*hitnilai.h
*/
#define awal {
#define akhir }
#define mulai() main()
#define cetak cout
#define tampil cprintf
#define masuk scanf
#define hapus() clrscr()
#define jika if
#define warna textcolor
#define tahan getche()
Simpan pada direktori C:\BC5\INCLUDE\..... , selanjutnya compile file hitnilai.h .
Buatlah program di bawah ini , kemudian gunakan header yang sudah anda buat ..
/*-----------------------------------*/
/*program dengan file header sendiri*/
/*----------------------------------*/
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include "hitnilai.h"
mulai()
awal
int absen,tugas1,UTS1,UAS1,nilai,absensi,tugas2,UTS2,UAS2,nilaiakhir;
hapus();
warna(4);
tampil("\nPROGRAM MENGHITUNG NILAI AKHIR MATA KULIAH\n");
cout<<endl;
cout<<"Masukkan Nilai Absensi : ";cin>>absen;
cout<<"Masukkan Nilai Tugas : ";cin>>tugas1;
cout<<"Masukkan Nilai U.T.S : ";cin>>UTS1;
cout<<"Masukkan Nilai U.A.S : ";cin>>UAS1;
absensi = absen*10/100;
tugas2 = tugas1*20/100;
UTS2 = UTS1*30/100;
UAS2 = UAS1*40/100;
nilaiakhir = absensi+tugas2+UTS2+UAS2;
cout<<endl;
cout<<"----------------------------------------------------";
cout<<endl;
cout<<"\tNilai Murni Absensi = "<<absen;
cout<<" * 10% = "<<absensi<<endl;
cout<<"\tNilai Murni Tugas = "<<tugas1;
cout<<" * 20% = "<<tugas2<<endl;
cout<<"\tNilai Murni U.T.S = "<<UTS1;
cout<<" * 30% = "<<UTS2<<endl;
cout<<"\tNilai Murni U.A.S = "<<UAS1;
cout<<" * 40% = "<<UAS2;
cout<<endl;
cout<<"\tNilai Akhir yang diperoleh sebesar : "<<nilaiakhir;
cout<<endl;
cout<<"-----------------------------------------------------";
tahan;
akhir
nih ada di bawah. . . .
Kamis, 26 Mei 2011
tugas 7
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
#include <iomanip.h>
main()
{
char namap[50], namak[50], tgl[50], lanjut, ulangi;
char *namab[9];
long hasat[9], jumhar[9], totbar[9];
long bayar, kembali;
int jumbel[9], kode[9] = {1,2,3,4,5,6,7,8,9};
int x, y, z = 0;
clrscr();
cout<<"\n\n\t\tNama Kasir = ";gets(namak);
cout<<"\n\n\t\tTanggal Login [dd/mm/yyyy] = ";gets(tgl);
cout<<"\n\n\t\tKasir saat ini "<<namak;
cout<<"\n\n\n\t\tPress Anykey To Countinue . . .";
lanjut = getche();
if(lanjut == 'Q')
goto program;
else
goto program;
program:
clrscr();
cout<<"\n\t\tMasukan Nama Pembeli = ";gets(namap);
cout<<"\t\tJumlah Data = ";cin>>y;
totbar[y] = 0;
for (x = 1; x <= y; x++)
{
cout<<"\n\t\t----------------------";
cout<<"\n\t\tData Ke-"<<x;
cout<<"\n\n\t\tInput Kode Barang = ";cin>>kode[x];
if(kode[x] == 1)
{
namab[x] = "Buku";
hasat[x] = 3500;
}
else if (kode[x] == 2)
{
namab[x] = "Pensil";
hasat[x] = 2000;
}
else if (kode[x] == 3)
{
namab[x] = "Pulpen";
hasat[x] = 2500;
}
else if (kode[x] == 4)
{
namab[x] = "Penggaris";
hasat[x] = 2500;
}
else if (kode[x] == 5)
{
namab[x] = "Serutan";
hasat[x] = 2000;
}
else if (kode[x] == 6)
{
namab[x] = "Penghapus";
hasat[x] = 2000;
}
else if (kode[x] == 7)
{
namab[x] = "Tipe-x";
hasat[x] = 4000;
}
else if (kode[x] == 8)
{
namab[x] = "Spidol";
hasat[x] = 5000;
}
else if (kode[x] == 9)
{
namab[x] = "Stabilo";
hasat[x] = 3000;
}
else if (kode[x] < 1 || kode[x] > 9)
{
clrscr();
cout<<"\n\t\tKode yang ada Masukan Salah.\n";
cout<<"\n\t\tPress Anykey to Continue . . .";
ulangi = getche();
if (ulangi == 'Q')
goto program;
else
goto program;
}
cout<<"\t\tAnda Memilih = "<<namab[x];
cout<<"\n\t\tDengan Harga Satuan = "<<hasat[x]<<endl;
cout<<"\t\tInput Jumlah Beli = ";cin>>jumbel[x];
jumhar[x] = hasat[x] * jumbel[x];
totbar[y] = totbar[y] + hasat[x] * jumbel[x];
}
cout<<"\n\t\tAda Kesalahan? [Y/T] ";
ulangi = getche();
if (ulangi == 'Y' || ulangi == 'y')
goto program;
bill:
clrscr();
cout<<"\nKasir = "<<namak;
cout<<setiosflags(ios::right)<<setw(55)<<"No faktur : FN-00"<<z<<endl;
cout<<"Pembeli = "<<namap;
cout<<setiosflags(ios::right)<<setw(46)<<"Tanggal = "<<tgl<<endl;
cout<<"--------------------------------------------------------------------------------";
cout<<" No Nama Harga Qty Jumlah \n";
cout<<"Unit Barang Satuan Harga \n";
cout<<"--------------------------------------------------------------------------------";
for(x = 1; x <= y; x++)
{
cout<<setiosflags(ios::left)<<setw(11)<<x;
cout<<setiosflags(ios::left)<<setw(19)<<namab[x];
cout<<setiosflags(ios::left)<<setw(19)<<hasat[x];
cout<<setiosflags(ios::left)<<setw(17)<<jumbel[x];
cout<<setiosflags(ios::left)<<setw(10)<<jumhar[x]<<endl;
}
cout<<"--------------------------------------------------------------------------------\n";
cout<<setiosflags(ios::right)<<setw(66)<<"Total Bayar = "<<totbar[y]<<endl;
cout<<setiosflags(ios::right)<<setw(66)<<"Uang Bayar = ";cin>>bayar;
if(bayar >= totbar[y])
kembali = bayar - totbar[y];
else
goto bill;
cout<<setiosflags(ios::right)<<setw(66)<<"Kembalian = "<<kembali<<endl;
cout<<"\n\n--------------------------------------------------------------------------------";
cout<<"\n\t\t\t\tTERIMA KASIH";
cout<<"\n--------------------------------------------------------------------------------";
cout<<"\n\nAnda Ingin Input Lagi? [Y/T] ";
ulangi = getche();
if (ulangi == 'Y' || ulangi == 'y')
{
z++;
goto program;
}
else
goto akhir;
akhir:
getch();
}ada nih. . . . ? ? ?
Langganan:
Postingan (Atom)