UTS / MID
UTS
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
main()
{
char nama[20],kode,tujuan[30];
int jml;
long int harga,total1,total2,pot;
clrscr();
cout<<"\n ============================="<<endl;
cout<<"\n = WELCOME TO NOVAL POSANGI AIR LINE ="<<endl;
cout<<"\n ============================="<<endl;
cout<<"\n Kode Tujuan (GORONTALO )= 1"<<endl;
cout<<" Kode Tujuan (AFRIKA SELATAN )= 2"<<endl;
cout<<" Kode Tujuan (JAPAN )= 3"<<endl;
cout<<" Kode Tujuan (BELANDA )= 4"<<endl;
cout<<"\n ==================================="<<endl;
cout<<"\n Masukkan Nama Anda : ";cin>>nama;
cout<<"\n Kode Penerbangan : ";cin>>kode;
if (kode=='1')
{
strcpy(tujuan,"GORONTALO -- JAPAN");
harga=1000000;
pot=0.5*harga;
}
else if (kode=='2')
{
strcpy(tujuan,"GORONTALO -- AFRIKA SELATAN");
harga=1000000;
pot=0;
}
else if (kode=='3')
{
strcpy(tujuan,"JAPAN -- GORONTALO");
harga=2000000;
pot=0;
}
else if (kode=='4')
{
strcpy(tujuan,"GORONTALO -- BELANDA");
harga=3000000;
pot=0;
}
clrscr();
cout<<"\n ============================="<<endl;
cout<<"\n = WELCOME TO NOVAL POSANGI AIR LINE ="<<endl;
cout<<"\n -----------------------------"<<endl;
cout<<"\n ============= NOTA PEMBAYARAN ================"<<endl;
cout<<"\n Nama Penumpang : "<<nama<<endl;
cout<<"\n Tujuan Anda : "<<tujuan<<endl;
cout<<"\n Jumlah Tiket : ";cin>>jml;
cout<<"\n Harga Tiket : Rp."<<harga<<endl;
total1=jml*harga;
cout<<"\n Total Harga : Rp."<<total1<<endl;
cout<<"\n Potongan : Rp."<<pot<<endl;
total2=total1-pot;
cout<<"\n Total Bayar : Rp."<<total2<<endl;
cout<<"\n ============================================"<<endl;
getch();
}
UTS
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
main()
{
char nama[20],kode,tujuan[30];
int jml;
long int harga,total1,total2,pot;
clrscr();
cout<<"\n ============================="<<endl;
cout<<"\n = WELCOME TO NOVAL POSANGI AIR LINE ="<<endl;
cout<<"\n ============================="<<endl;
cout<<"\n Kode Tujuan (GORONTALO )= 1"<<endl;
cout<<" Kode Tujuan (AFRIKA SELATAN )= 2"<<endl;
cout<<" Kode Tujuan (JAPAN )= 3"<<endl;
cout<<" Kode Tujuan (BELANDA )= 4"<<endl;
cout<<"\n ==================================="<<endl;
cout<<"\n Masukkan Nama Anda : ";cin>>nama;
cout<<"\n Kode Penerbangan : ";cin>>kode;
if (kode=='1')
{
strcpy(tujuan,"GORONTALO -- JAPAN");
harga=1000000;
pot=0.5*harga;
}
else if (kode=='2')
{
strcpy(tujuan,"GORONTALO -- AFRIKA SELATAN");
harga=1000000;
pot=0;
}
else if (kode=='3')
{
strcpy(tujuan,"JAPAN -- GORONTALO");
harga=2000000;
pot=0;
}
else if (kode=='4')
{
strcpy(tujuan,"GORONTALO -- BELANDA");
harga=3000000;
pot=0;
}
clrscr();
cout<<"\n ============================="<<endl;
cout<<"\n = WELCOME TO NOVAL POSANGI AIR LINE ="<<endl;
cout<<"\n -----------------------------"<<endl;
cout<<"\n ============= NOTA PEMBAYARAN ================"<<endl;
cout<<"\n Nama Penumpang : "<<nama<<endl;
cout<<"\n Tujuan Anda : "<<tujuan<<endl;
cout<<"\n Jumlah Tiket : ";cin>>jml;
cout<<"\n Harga Tiket : Rp."<<harga<<endl;
total1=jml*harga;
cout<<"\n Total Harga : Rp."<<total1<<endl;
cout<<"\n Potongan : Rp."<<pot<<endl;
total2=total1-pot;
cout<<"\n Total Bayar : Rp."<<total2<<endl;
cout<<"\n ============================================"<<endl;
getch();
}
0 Komentar untuk "ALGORITMA dan PEMOGRAMAN BORLAND C++ UTS/MID"
Untuk menggunakan emoticon gunakan simbol berikut ^_^
:) | ^_^ | :-d | :-bd | \o/ | =( | :( | ;) | :D | =D | :p | @@,