Nested If #1

#include< conio.h>
#include< stdio.h>
#include< iostream.h>
main()
{
char merk[15],ukuran[3],kode[3];
long int harga;
clrscr();
cout<<"Input Kode Baju (PL/SK) : ";cin>>kode;
cout<<"Input Kode Ukuran (XL/L) : ";cin>>ukuran;

if(!strcmp(kode,"PL")||!strcmp(kode,"pl"))
{
strcpy(merk,"POLO SHIRT");
if(!strcmp(ukuran,"XL")||!strcmp(ukuran,"xl"))
{harga= 500000;}

else if(!strcmp(ukuran,"L")||!strcmp(ukuran,"l"))
{harga= 400000;}

else
cout<<"Kode Salah !!!!";
}

if(!strcmp(kode,"SK")||!strcmp(kode,"sk"))
{
strcpy(merk,"SKATER");
if(!strcmp(ukuran,"XL")||!strcmp(ukuran,"xl"))
{harga= 450000;}

else if(!strcmp(ukuran,"L")||!strcmp(ukuran,"l"))
{harga= 350000;}

else
cout<<"Kode Salah !!!!";
}

else
cout<<"Kode Salah !!!!";
clrscr();
cout<<"Kode Baju Yang Di Input :"<< kode<< endl;
cout<<"Kode Ukuran Yang Di Input :"<< ukuran<< endl;
cout<<"Merk Bajunya Adalah :"<< merk<< endl;
cout<<"Harga Bajunya Adalah :"<< harga<< endl;

getch();
}

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 komentar:

Posting Komentar