Tugas program SURGA BUKU
#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main()
{
char *nama, kode [10];
int harga, jml, total = 0, buku_gratis;
clrscr();
cout << “SURGA BUKU” << endl;
cout << “masukan kode barang:”; cin >> kode;
cout << “jumlah barang:”; cin >> jml;
if(!strcmp(kode,”BRG01″))
{
nama=”buku 01″;
harga=10000;
total=jml*harga;
if(total<=100000)
{
buku_gratis=15000;
}
}
else if(!strcmp(kode,”BRG02″))
{
nama=”buku 02″;
harga=20000;
total=jml*harga;
if(total>100000 && 151000>total)
{
buku_gratis=25000;
}
}
else
{
nama=”buku 03″;
harga=30000;
total=jml*harga;
if(total>151000)
{
buku_gratis=40000;
}
}
cout << “nama barang:” << nama << endl;
cout << “harga barang:”<< harga << endl;
cout << “total:”<< total << endl;
cout << “buku gratis:”<< buku_gratis << endl;
getch();
}
-
Recent
-
Links
-
Archives
- January 2010 (1)
- December 2009 (3)
- October 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS

