IF Bersarang

Leave a comment

Inilah Contoh If Bersarang :

#include<stdio.h>
#include<conio.h>
#include<iostream.h>
main( )
{
char kode,ukuran,merk[15];
long harga=0;
clrscr( );                                          
cout<<“Kode Baju : “;cin>>kode;
cout<<“Ukuran : “;cin>>ukuran;
if (kode==’1′)
{
strcpy(merk,”H & R”);
if (ukuran==’S’ || ukuran ==’s’)
harga=45000;
else
harga=60000;
}
else if (kode==’2′)
{
strcpy(merk,” Adidas”);
if (ukuran==’S’ || ukuran == ‘s’)
harga=65000;
else
harga=75000;
}
else
cout<<“Salah Kode Baju”<<endl;
cout<<“————————“<<endl;
cout<<“Merk Baju : “<<merk<<endl;
cout<<“Harga Baju : “<<harga<<endl;
getch();
}

#SEMOGA BERMANFAAT 🙂

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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

me :)

Miss Moody

favorite song

Jam

Kalender ku

April 2017
M T W T F S S
« Oct    
 12
3456789
10111213141516
17181920212223
24252627282930

Masukkan alamat surat elektronik Anda untuk mengikuti blog ini dan menerima pemberitahuan tentang tulisan baru melalui surat elektronik.

Join 6 other followers

flag counter

%d bloggers like this: