Aliabdat's Blog

Just another WordPress.com weblog

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();

}

Advertisement

December 4, 2009 - Posted by | Uncategorized

No comments yet.

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.