Monday, November 14, 2022

Tugas Materi Pertemuan 9

 


Assalamualaikum Wr.wb

Nama : Reza Hidayatulloh

Nim : 3420210019

Prodi : Teknik Informatika

Lampiran Tugas 1


#include <iostream.h>
#include <conio.h>
#include <stdio.h>

//Nama   = REZA HIDAYATULLOH
//NIM    = 3420210019
//Prodi  = Teknik Informatika

void main() {
   /*
      Sumber : http://vvv.cplupsplus.com/doc/tutorial/pointers/
      suautu variable adalah lokasi di memori komputer yang dapat diakses
          oleh pengenal mereka (nama variable tersebut). Dengan cara ini
          program tidak perlu peduli dengan alamat fisik data didalam memori.
      program hanya perlu menggunakan pengenal (nama variable) setiap kali
         merujuk kedalam suatu variable.
   */
   int nilai1, nilai2, *nilai3;
   nilai1 = 25;
   cout<<" Nilai 1 adalah "<<nilai1<<endl;
   nilai2 = nilai1;
   cout<<" Nilai 2 adalah "<<nilai2<<endl;
   /*
      Variable nilai3 adalah variable yang bertipe pointer.
      Nilai variable nilai3 harus berupa alamat suatu memori.
      Variable nilai3 adalah berisi alamat memori variable nilai.
   */
   nilai3 = &nilai1;
   cout<<" Nilai 3 adalah "<<nilai3;
   getch();
   }



Lampiran Tugas 2


#include <iostream.h>
#include <conio.h>
#include <stdio.h>

//Nama   = REZA HIDAYATULLOH
//NIM    = 3420210019
//Prodi  = Teknik Informatika

void main() {
   int nilai1, nilai2;
   //Variable pointerku bertipe pointer
   int *pointerku;
   //Variable pointerku diisi alamat dari variable nilai1
   pointerku = &nilai1;
   /*
      Alamat memori variable yang ditunjuk variable pointerku diisi nilai 30.
      Alamat ini ternyata adalah alamatnya variable nilai.
      Maka variable nilai1 jadi bernilai 20.
   */
   *pointerku = 30;
    pointerku = &nilai2;
   *pointerku = 35;
   cout << "Nilai 1 adalah " << nilai1 << endl;
   cout << "Nilai 2 adalah " << nilai2 << endl;
   getch();

}


Lampiran Tugas 3


#include <iostream.h>

#include <conio.h>

#include <stdio.h>


//Nama   = REZA HIDAYATULLOH

//NIM     = 3420210019

//Prodi    = Teknik Informatika


void main() {

   /*

      1. Ketika suatu variable di deklarasikan, memori yang diperlukan untuk

         menyimpan nilainya ditetapkan pada suatu lokasi tertentu didalam

         memori komputer pada suatu alamat.

      2. Secara umum program C++ tidak menentukan sendiri alamat memori dimana

         nilsi variable tersebut disimpan. Tugas ini diserahkan kepada 05

         (operating system) untuk menentukan dilokasi mana (alamat) nilai

         dari variable tersebut disimpan. Hal ini dilakukan pada saat runtime

         (pada saat program dijalankan).

   */

   int nilai[15];

   int*p;

   nilai[2] = 15;

   nilai[3] = 20;

   cout << "Nilai [2] adalah " << nilai[2] << endl;

   cout << "Nilai [3] adalah " << nilai[3] << endl;

   p = &nilai[2];

   cout << "Alamat Nilai [2] adalah " << p << endl;

   p = &nilai[3];

   cout << "Alamat Nilai [3] adalah " << p << endl;

   getch();

}

Thursday, November 10, 2022

Tugas Materi Pertemuan 8

Nama : Reza Hidayatulloh
Nim : 3420210019
Prodi : Teknik Informatika



Lampiran Tugas 1



#include <conio.h>
#include <iostream>
#include <stdio.h>
#include <iomanip.h>

//Nama : Reza Hidayatulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void judul();
/*
https://cplusplus.com\reference/iomanip/setv/
Sets the field vidth to be used on output operations.
https://csplusplus.com/reference/iomanip/setiosflags/
Sets the format flags specified by parameter mask.
*/
void main() {
   int i, jml;
   judul();
   printf("Masukan jumlah data: ");cin>>jml;
   cout<<endl;
   char nama[5][20];
   int absen[5],quis[5],uts[5],uas[5];
   double total[5];
   for(i=1;i<=jml;i++) {
      printf("Data ke %d\n",i);
      printf("Nama siswa  :");gets(nama[i]);
      printf("Nilai Absen :");cin>>absen[i];
      printf("Nilai quis  :");cin>>quis[i];
      printf("Nilai uts   :");cin>>uts[i];
      printf("Nilai uas   :");cin>>uas[i];
      total[i]=(absen[i]*0.1)+(quis[i]*0.2)+(uts[i]*0.3)+(uas[i]*0.4);
      cout<<endl;
}
 clrscr();
 puts("===============================================");
 puts("No Nama Siswa   Absen  Quis  UTS  UAS  Total");
 puts("===============================================");

 for(i=1;i<=jml;i++)
 {
    cout<<setw(3)<<setiosflags(ios::left)<<i;
    cout<<setw(13)<<nama[i];
    cout<<setw(7)<<absen[i];
    cout<<setw(6)<<quis[i];
    cout<<setw(5)<<uts[i];
    cout<<setw(5)<<uas[i];
    printf("%.2f", total[i]);
    cout<<endl;
 }
 puts("===============================================");
 getch();
}

void judul() {
   puts("===============================================");
   puts("\tContoh Progam Array");
   puts("===============================================");
}



Lampiran Tugas 2



#include <conio.h>
#include <iostream>
#include <stdio.h>
#include <iomanip.h>

//Nama : Reza Hidayatulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
   puts("==================================");
   puts("      Gerobak Geprek Bensu");
   puts("==================================");
   puts("      Kode   Jenis   Harga");
   puts("==================================");
   puts("      D      Dada    13000");
   puts("      P      Paha    9500");
   puts("      S      Sayap   10000");

   char nama[20];
   int i, jml;

   puts("==================================");
   printf("Masukan nama pembeli: ");cin>>nama;
   printf("Masukan jumlah beli: ");cin>>jml;


   char kode;
   char jenis[5][20];
   int jumlah[5], harga[5];
   float total[5];
   float tobay=0, pajak, grand;
   for(i=1;i<=jml;i++)
   {

      printf("\n");
      printf("Data ke               : %d\n",i);
      printf("Masukan kode [D][P][S]: ");cin>>kode;
      printf("Jumlah beli           : ");cin>>jumlah[i];

      switch(kode)
      {
         case 'D':
         case 'd':
            harga[i] = 13000;
            strcpy(jenis[i], "Dada");
            break;
         case 'P':
         case 'p':
            harga[i] = 9500;
            strcpy(jenis[i], "Paha");
            break;
         default:
            harga[i] = 10000;
            strcpy(jenis[i], "Sayap");
            break;
      }

      //Hitung Total
      total[i] = jumlah[i]*harga[i];
      tobay = tobay + total[i];
   }

   clrscr();
   puts("==================================");
   puts("      Gerobak Geprek Bensu");
   puts("==================================");
   puts("No  Jenis  Harga  Jml  Total");
   puts("==================================");

   for(i=1;i<=jml;i++)
   {
      cout<<setw(4)<<setiosflags(ios::left)<<i;
      cout<<setw(7)<<jenis[i];
      cout<<setw(7)<<harga[i];
      cout<<setw(5)<<jumlah[i];
      cout<<total[i]<<endl;
   }

   //Hitung Pajak
   pajak = 0.1 * tobay;

   //Hitung Grand
   grand = tobay + pajak;

   puts("==================================");
   printf("\tTotal Bayar: %.0f\n", tobay);
   printf("\tPajak      : %.0f\n", pajak);
   printf("\tGrand Total: %.0f\n", grand);

   getch();
}

Monday, October 31, 2022

TUGAS MATERI PERTEMUAN 7



 



Nama : Reza Hidayatulloh
Nim : 3420210019
Prodi : Teknik Informatika



Tugas1


#include <iostream.h>
#include <conio.h>
#include <stdio.h>


 //Nama : Reza Hidayatulloh
 //Nim  : 3420210019
 //Prodi: Teknik Informatika

void main()
{
int i;
   int a = 5;
   int b = 10;
   cout<<"-------------------------------\n";
   cout<<" No  A     B    A*A  B*B\n";
   cout<<"-------------------------------\n";
   for(i=1;i<=10;i++)
   {
    gotoxy(2,3+i);cout<<i;
      gotoxy(6,3+i);cout<<a;
      gotoxy(12,3+i);cout<<b;
      gotoxy(17,3+i);cout<<a*a;
      gotoxy(22,3+i);cout<<b*b;
      a=a+4;
      b=b+2;
      cout<<"\n";
   }
   cout<<"-------------------------------\n";
   getch();
}

Tugas2

#include <iostream.h>
#include <conio.h>
#include <stdio.h>


 //Nama : Reza Hidayatulloh
 //Nim  : 3420210019
 //Prodi: Teknik Informatika

void judul(){
   puts("====================================");
   puts("\tContoh Array Dimensi 1");
   puts("====================================");
   }

 void main()
 {
  judul();
   int i;
   float harga [5];
   harga[0]=1000;
   harga[1]=2000;
   harga[2]=3000;
   harga[3]=4000;
   harga[4]=5000;
   harga[5]=6000;
   printf("Variable harga 1 adalah %.0f\n",harga[1]);
   printf("Variable harga 3 adalah %.0f\n",harga[3]);
   for(i=1;i<=3;i++)
   {
    cout<<endl;
   }
   puts("Nilai dari Seluruh Variabel adalah:");
   for(i=0;i<5;i++)
   {
    printf("variabel harga %d adalah %.0f\n",i,harga[i]);
   }
   getch();
 }


Tugas3


#include <iostream.h>
#include <conio.h>
#include <stdio.h>


 //Nama : Reza Hidayatulloh
 //Nim  : 3420210019
 //Prodi: Teknik Informatika

void judul () {
    puts("========================================");
   puts(" Contoh Array Dimensi 2 ");
   puts("========================================");
}

void main() {
judul();
   int i;
   char hari[7][10]={"Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"};
   printf("Hari ke 4 adalah %s\n",hari[4]);
   printf("Hari ke 5 adalah %s\n",hari[5]);
   for(i=1;i<=5;i++) { cout<<endl; }
   puts("Nilai dari seluruh variable hari adalah:");
   for(i=0;i<7;i++) {
   printf("Variable hari %d adalah %s\n",i,hari[i]);
   }
   getch();
}

Friday, October 28, 2022

TUGAS MATERI PERTEMUAN 6

 

Nama : Reza Hidayatulloh

Nim   : 3420210019

Prodi: Teknik Informatika

tugas 1



/*---------------------------*/
/* Program for - bilangan naik */
/*---------------------------*/

#include <stdio.h>
#include <conio.h>
#include <iostream.h>

//Nama : Reza Hidayatulloh
//Nim    : 3420210019
//Prodi : Teknik Informatika

void main ()
{
int a;
   for (a=1;a<=10;a++)
   {
    cout<<"Ini Adalah Baris Ke - " <<a<<endl;
   }
   getch ();
   }

tugas 2


#include <iostream.h>

#include <conio.h>


//Nama : Reza hidaytulloh

//Nim  : 3420210019

//Prodi: Teknik Informatika


void main()

{

puts ("---------------------------");

puts ("   Program For Bersarang   ");

puts ("---------------------------");

int a,b;

   for (a=1;a<=4;a++) {

    for (b=2;b<=2;b++) {

    printf("Latihan Algoritma \n");

      cout<<endl;

      }

   }

   getch ();

}


tugas 3


#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
int a,b;
   for (a=1;a<=5;a++)
   {
    printf ("\n");
for (b=a;b<=5;b++)
      {
      printf ("%d",a);
      }
   }
   getch ();
}

tugas 4


#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
int a,b;
   char lagi;

 atas:
  clrscr();
   cout<<"Masukan Bilangan = ";cin>>a;
   b = a % 2;
   printf ("Nilai %d %% 2 adalah = %d",a,b);
   printf ("\n\nIngin Hitung Lagi [Y/T] : ");
   lagi = getche ();
   if (lagi == 'Y' || lagi == 'y') { goto atas; }
   getch();
 }

tugas 5

#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
int bil = 1;
    while (bil<=10)
    {
    printf (" %d ",bil);
      bil++;
    }
    bil = 2;
    cout<<endl;
    do
    {
    printf (" %d ",bil);
      bil+=2;
    } while (bil <=10);
   getch();
 }

tugas 6

#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
 {
    int bil = 2;
    int b=0;
    do
    {
    if (bil <20) { printf (" %d +",bil); }
else {printf (" %d = ",bil); }
      b = b + bil;
      bil = bil + 2;
    } while (bil<=20);
    cout<<b;
   getch();
 }

tugas7

#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
 {
    int a,b,c;
    for (a=2;a<=10;a+=2)
    {
    b=2; c=0;
      do
      {
      c = c + b;
         if (a == b) {cout<<b<<" = "<<c;} else {cout<<b<<" + ";}
         b = b + 2;
      }while (b<=a);
      cout<<endl;
    }
   getch();
 }

tugas 8



#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
    int a,b,c;
    for (a=1;a<=9;a+=2)
    {
    b=1; c=1;
      do
      {
      c = c * b;
         if (a == b) {cout<<b<<" = "<<c;} else {cout<<b<<" * ";}
         b = b + 2;
      }while (b<=a);
      cout<<endl;
    }
   getch();
 }


Tuesday, October 18, 2022

TUGAS MATERI PERTEMUAN 5

 






Nama : Reza Hidayatulloh
Nim : 3420210019
Prodi : Teknik Informatika


#include <iostream.h>
#include<stdio.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main  ()
 {
 char kode, lagi;

 //Deklarasi Label
 atas:
 clrscr();
 cout<<"input your size catalog shirt [S/M/L] : ";
 kode = getche ();
 cout<<'\n';
 switch (kode) {
   case 'S': case 's':
 cout<<"why not"; break;
   case 'M': case 'm':
 cout<<"suicidal anthem"; break;
   case 'L': case 'l':
 cout<<"calvin klein"; break;
   default:
   cout<<"Anda Salah Memasukan Kode";
 }
 cout<<'\n';
 cout<<"\nYou want buy more? [Y/T]: ";
 lagi = getche();
 if(lagi == 'Y' || lagi == 'y') goto atas;
 getch();
}



#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza Hidayatulloh
//Nim  : 3420210019
//prodi: Teknik Informatika
 void main  ()
 {
  char kode, lagi; char nama[50], bonus[50];
   int jml; float harga, total, pot, ppn, grand;
 lagi:
  clrscr();
   puts("****************************************");
   printf("Masukan Kode laptop [1/2/3]: ");cin>>kode;
   printf("Jumlah Pembelian laptop    : ");cin>>jml;
   switch (kode)  {
    case '1':
      strcpy(nama,"asus tuf gaming"); harga = 9000000;
         break;
      case '2':
      strcpy(nama,"msi gf63 thin 11c"); harga = 8000000;
         break;
      default:
      strcpy(nama,"acer nitro");
         harga = 9000000;
   }

   total = harga * jml; ppn = 0.1 * total;

   if(jml>5) {
    strcpy(bonus,"keyboard srgb");
      pot = 0.1 * total;
   } else {
    strcpy(bonus,"Maaf ya Tidak Dapat Bonus");
      pot = 0;
   }
   grand = total + ppn - pot;
   clrscr();
   puts("-----------------------------------------");
   puts("          ***Berkah Jaya***");
   puts("           Jl. Kesetiaan No.01");
   puts("-----------------------------------------");
   cout<<"Nama laptop : "<<nama  <<endl;
   cout<<"Harga laptop: "<<harga <<endl;
   cout<<"Bonus       : "<<bonus <<endl;
   cout<<"Total Bayar : "<<total <<endl;
   cout<<"Potongan    : "<<pot   <<endl;
   cout<<"PPN         : "<<ppn   <<endl;
   cout<<"Grand Total : "<<grand <<endl;
   puts("-----------------------------------------");
   puts("           ***Terima Kasih***            ");
   cout<<"           Input Data Lagi...?";cin>>lagi;
   if (lagi == 'y' || lagi == 'y') {goto lagi;}

getch();
 }



#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()

{

char nama[20],tipe[20],souvenir[20];
char kode,lagi;
int lama;
float harga,total,admin=200000,ubay,ukem;



awal:

clrscr();
puts("PENGINAPAN ATIKA HOTEL");
puts("********************************");
cout<<"Nama Penyewa      : ";cin>>nama;
cout<<"Kode Kamar [S/F/D]: ";cin>>kode;



if (kode == 'S' || kode == 's')
{
strcpy(tipe,"Superior Room");
harga = 400000;
}
else if (kode == 'F' || kode == 'f')
{
strcpy(tipe,"Family Room");
harga = 300000;
}
else if (kode == 'D' || kode == 'd')
{
strcpy(tipe,"Deluxe Room");
harga = 200000;
}
else
{
puts("******************************");
cout<<"Kode kamar yang anda masukan salah, ingin input lagi?";
cin>>lagi;
switch(lagi)
{
case 'Y':
case 'y':
goto awal;
default:
goto akhir;
}
}


clrscr();
puts("PENGINAPAN ATIKA HOTEL");
puts("******************************");
cout<<"Nama Penyewa      : "<<nama<<endl;
cout<<"Kode Kamar [S/F/D]: "<<kode<<endl;
cout<<"Lama Menginap     : ";cin>>lama;
puts("******************************");
if (lama>=5)
{
strcpy(souvenir,"Selimut Batik");
}
else
{
strcpy(souvenir,"Tidak Dapat");
}

total = (harga * lama) + admin;


cout<<"Tipe Kamar \t\t: "<<tipe<<endl;
cout<<"Lama Menginap \t\t: "<<lama<<" hari"<<endl;
cout<<"Souvenir \t\t: "<<souvenir<<endl;
printf("Biaya Sewa \t\t: Rp.%8.2f \n",harga);
printf("Biaya Administrasi \t: Rp.%8.2f \n",admin);
printf("Total Biaya Sewa \t: Rp.%8.2f \n",total);
puts("******************************");
cout<<"Uang Bayar : ";cin>>ubay;
ukem = ubay - total;
   cout<<"Uang kembali : "<<ukem<<endl;
   cout<<"Ingin input lagi [Y/T] ";cin>>lagi;
switch(lagi)

{
case 'Y':
case 'y':
goto awal;
default:
goto akhir;
}

akhir:
getch();
}








Tuesday, September 27, 2022

TUGAS MATERI PERTEMUAN 4

 


assalamualaikum wr.wb

Nama :Reza Hidayatulloh

Nim   :3420210019

Prodi :Teknik Informatika



1
#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza Hidayatulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
  //deklarasi variable
  int absen,tugas,uts,uas;
  float total;

  puts("program menghitung nilai mahasiswa");
  puts("************************************");
  printf("masukan nilai absen: ");scanf("%d",&absen);
  cout<<"masukan nilai tugas: ";cin>>tugas;
  printf("masukan nilai uts: ");scanf("%i",&uts);
  cout<<"masukan nilai uas: ";cin>>uas;

  //proses perhitungan
  total = (absen*0.1)+(tugas*0.2)+(uts*0.3)+(uas*0.4);
  puts("************************************");
  cout<<"total adalah: "<<total<<" (bentuk tidak terformat)\n";
  printf("total adalah: %.2f (bentuk yang terformat)\n",total);
  puts("************************************");

  //kondisi
  if (total >=75 )
  { cout<<"selamat anda lulus"; }
  else
  { cout<<"maaf anda tidak lulus"; }
  getch();
}
















2
#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza Hidayatulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
  int pilih;
  char huruf [20];

  printf ("Silakan Pilih Program [1/2]:") ; cin >> pilih;
  //scanf ("%d", & pilih);
  /*
  There are two problems with using scanf() to get a number:
  First, validation/error handling is poor.
  The second problem is that of leaving characters in the buffer.
  Sumber: https://faq.cprogram.com/cgi-bin/smartfaq.cgi?
  */
  if (pilih == 1)
   {
   clrscr();
   puts ("************************");
   puts ("\Contoh Program Strlen");
   puts ("************************");
   cout <<"Masukan Sembarang Kata = "; gets (huruf);
   cout <<"Panjang Kata Yang Diinput = "<<strlen(huruf);
   getch() ;
   }

  else if (pilih == 2)
   {
   clrscr();
   puts ("************************");
   puts ("\Contoh Program Strcmp");
   puts ("************************");

   char a1 [] = "S";
   char a2 [] = "s";
   char b1 [] = "S";

   cout <<"Hasil Perbandingan "<<a1<<" dan "<<a2<< "->";
   cout <<strcmp (a1,a2) <<endl;
   cout <<"Hasil Perbandingan "<<a2<<" dan "<<a1<< "->";
   cout <<strcmp (a2,a1) <<endl;
   cout <<"Hasil Perbandingan "<<a1<<" dan "<<b1<< "->";
   cout <<strcmp (a1,b1) <<endl;

  getch();
  }
  else
  {
  printf ("Maaf Pilihan Anda Salah..");
  }
}








#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza Hidayatulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika

void main()
{
  char gol,jab[10];
  long gapok;
  cout<<endl<<"data jabatan"<<endl
  <<"***************************"<<endl;
  cout<<"masukan golongan [1/2/3/4]: ";cin>>gol;
  if(gol=='1')
  {
    strcpy(jab,"direktur");
    gapok=7000000;
  }
  else if(gol=='2')
  {
    strcpy(jab,"manajer");
    gapok=5000000;
  }
  else if(gol=='3')
  {
    strcpy(jab,"supervisor");
     gapok=4000000;
  }
  else if(gol=='4')
  {
    strcpy(jab,"karyawan");
    gapok=3000000;
  }
  else
  {
    printf("golongan %c tidak terdaftar.\n",gol);
    strcpy(jab,"none");
    gapok=0;
  }
  cout<<"jabatan = "<<jab<<endl;
  cout<<"gaji pokok = "<<gapok<<endl;
  getch();
}






#include <stdio.h>
#include <iostream.h>
#include <conio.h>

//Nama : Reza hidaytulloh
//Nim  : 3420210019
//Prodi: Teknik Informatika
void main()
{
  char kode,ukuran,merk[15]="none";
  long harga=0;
  cout<<"kode baju [1/2/3] : ";cin>>kode;
  cout<<"ukuran [S/M]    : ";cin>>ukuran;
  if (kode=='1')
  {
    strcpy(merk,"SLIPKNOT");
    if (ukuran=='S' || ukuran =='s') { harga=45000; } else { harga=60000; }
  }
  else if (kode=='2')
  {
    strcpy(merk,"REEBOK");
    //bentuk penulisan if versi singkat
    if (ukuran=='S' || ukuran == 's') harga=65000; else harga=75000;
  }
  else if (kode=='3')
  {
  strcpy(merk,"SUICIDE ANTHEM");
  if (ukuran=='S' || ukuran =='s') harga=120000; else harga=125000;
  }
  else
  {
    cout<<"salah kode baju"<<endl;
  }
  cout<<"merk baju : "<<merk<<endl;
  cout<<"harga baju : "<<harga<<endl;
  getch();
}