Wednesday, November 16, 2022

Algoritma dan Struktur Data Pertemuan 9

 Assalamualaikum wr.wb                                                                                                                                                                                                                 


Nama: Muhamad Syarif Ramadhan

Nim  : 3420227001
Prodi: Teknik Informatika

Contoh 1

                                                      Lampiran Contoh 1 sofware Borland C++

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

// Nama : Muhamad Syarif Ramadhan
// Nim  : 3420227001

void main() {

    /*
      Sumber: http://www.cplusplu.com/doc/tutorial/pointers/
      suatu variable adalah lokasi dimemori komputer yang dapat diakses
      oleh pengenal mereka (nama variable tersebut). Dengan cara ini
      progam tidak perlu peduli dengan alamat fisik data didalam memori.
      progam hanya perlu menggunakan pengenal (nama variable) setiap kali
      merujuk kedalam suatu variable.
   */

   int nilai1, nilai2, *nilai3;
   nilai1 = 15;
   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 niali3 adalah berisi alamat memori variable nilai1.
   */

   nilai3 = &nilai1;
   cout<<"Nilai 3 adalah "<<nilai3;
   getch();
}

Contoh 2

                                                                            Lampiran Contoh 2 sofware Borland C++

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

// Nama : Muhamad Syarif Ramadhan
// Nim  : 342022701


void main()
{
   int nilai1, nilai2;
   //variable pointerku bertipe pointer
   int *pointerku;
   //variable pointerku diisi alamat dari variable nilai
   pointerku = &nilai1;

   /*
      Alamat memori variable yang ditunjuk variable pointerku diisi nilai 10.
      Alamat ini Ternyata adalah alamatnya variable nilai1.
      maka variable nilai1 jadi bernilai 10.
   */

   *pointerku = 10;
   pointerku = &nilai2;
   *pointerku = 20;
   cout<<"Nilai 1 adalah "<<nilai1<<endl;
   cout<<"Nilai 2 adalah "<<nilai2<<endl;
   getch();
}

                                                 Sekian dan Terimakasih
                                             Wassalamualaikum wr.wb

Algoritma dan Struktur Data Pertemuan 8

 Assalamualaikum wr.wb                                                                                                                                                                                                                 


Nama: Muhamad Syarif Ramadhan

Nim  : 3420227001
Prodi: Teknik Informatika

Contoh 1

                                                      Lampiran Contoh 1 sofware Borland C++



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

// Nama : Muhamad Syarif Ramadhan
// Nim  : 3420227001

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 ("\tMasukan Jumlah Data: "); cin >> jml;
   cout<<endl;
   char nama[7][23];
   int absen[5],quis[5],uts[5],uas[5];
   double total[5];
   for (i=1;i<=jml;i++) {
      printf ("\tData ke %d\n",i);
      printf ("\tNama Siswa  :"); gets(nama[i]);
      printf ("\tNilai Absen :"); cin >> absen[i];
      printf ("\tNilai Quis  :"); cin >> quis[i];
      printf ("\tNilai Uts   :"); cin >> uts[i];
      printf ("\tNilai 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();
 cout << endl;
 puts ("\t==============================================================");
 puts ("\t\t No Nama Siswa   Absen  Quis  UTS  UAS  Total");
 puts ("\t==============================================================");

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

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

Contoh 2

                                                                            Lampiran Contoh 2 sofware Borland C++



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

// Nama : Muhamad Syarif Ramadhan
// Nim  : 3420227001

void main()
{
   puts ("\t======================================");
   puts ("\t\t   Chicken Factory ");
   puts ("\t======================================");
   puts ("\t\t Kode   Jenis   Harga");
   puts ("\t======================================");
   puts ("\t\t D      Dada    13000");
   puts ("\t\t P      Paha    9500");
   puts ("\t\t S      Sayap   10000");

   char name[20];
   int i, jml;

   puts   ("\t======================================\n");
   printf ("\tMasukkan Nama Pembeli : "); cin >> name;
   printf ("\tMasukkan Jumlah Beli  : "); cin >> jml;


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

      printf ("\n");
      printf ("\t Data Ke                 : %d\n", i);
      printf ("\t Masukkan Kode [D][P][S] : "); cin >> code;
      printf ("\t Jumlah Beli             : "); cin >> jumlah[i];

      switch(code)
      {
         case 'D': case 'd':
            price[i] = 16000;
            strcpy (jenis[i], "Dada");
            break;
         case 'P': case 'p':
            price[i] = 12000;
            strcpy (jenis[i], "Paha");
            break;
         case 'S': case 's':
            price[i] = 12500;
            strcpy (jenis[i], "Sayap");
            break;
         default:
          price[i] = 0;
            strcpy (jenis[i], "Not Found");
      }

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

   clrscr();
   puts ("\t=============================================");
   puts ("\t\t       Chicken Factory");
   puts ("\t=============================================");
   puts ("\tNo  Jenis        Harga      Jumlah      Total");
   puts ("\t=============================================");

   for(i=1;i<=jml;i++)
   {
      cout << "\t" << setw(4) << setiosflags (ios::left) << i;
      cout << setw(13) << jenis[i];
      cout << setw(5)  << setiosflags (ios::right) << price[i];
      cout << setw(9)  << jumlah[i];
      cout << setw(14) << total[i] << endl;
   }

   //Hitung Pajak
   pajak = 0.1 * tobay;

   //Hitung Grand
   grand = tobay + pajak;

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


   cout << "\t=============================================" << endl;
   cout << "\t\t   TERIMAKASIH SUDAH ORDER" << endl;
   cout << "\t=============================================" << endl;
   getch();
}
                                                  Sekian dan Terimakasih
                                             Wassalamualaikum wr.wb

Thursday, November 3, 2022

Algoritma dan Struktur Data Pertemuan 7

Assalamualaikum wr.wb                                                                                                                                                                                                                 


Nama: Muhamad Syarif Ramadhan

Nim  : 3420227001
Prodi: Teknik Informatika

Contoh 1

                                                      Lampiran Contoh 1 sofware Borland C++




#include <iostream.h>

#include <conio.h>


void main(){

//Nama : Muhamad Syarif Ramadhan

//Nim  : 3420227001


int i;

int a = 24;

int b = 42;

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 (7,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+5;

b=b+10;

cout<<"\n";

      }

   cout<<"------------------------------\n";

getch();


Contoh 2

                                                                            Lampiran Contoh 2 sofware Borland C++

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

//Nama : Muhamad Syarif Ramadhan
//Nim  : 3420227001

void judul(){
 cout<<"===================================="<<endl;
 cout<<"\tContoh Array Dimensi 1"<<endl;
 cout<<"===================================="<<endl;
}

void main(){
  judul();
   int i;
   float harga [5];
   harga[0]=3000;
   harga[1]=4000;
   harga[2]=6000;
   harga[3]=7000;
   harga[4]=10000;
   harga[5]=12000;
   printf("Variable harga 3 adalah %.0f\n",harga[3]);
   printf("Variable harga 4 adalah %.0f\n",harga[4]);
   for(i=3;i<=4;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();
}

Contoh 3


                                                            Lampiran Contoh 3 sofware Borland C++

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

//Nama : Muhamad Syarif Ramadhan
//Nim  : 3420227001

void judul();

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

 void judul(){
   cout<<"===================================="<<endl;
   cout<<"\tContoh Array Dimensi 2"<<endl;
   cout<<"===================================="<<endl;
}

                                                Sekian dan Terimakasih
                                             Wassalamualaikum wr.wb

Wednesday, October 26, 2022

Algoritma dan Struktur Data Pertemuan 6

 Assalamualaikum wr.wb                                                                                                                                                                                                                 


Nama: Muhamad Syarif Ramadhan
Nim  : 3420227001
Prodi: Teknik Informatika

Contoh 1

                                                      Lampiran Contoh 1 sofware Borland C++

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


void main()
{
//Nama: Muhamad Syarif Ramadhan
//Nim : 3420227001

int a;
   for (a=1;a<=10;a++){
    cout<<"Ini adalah baris ke -"<<a<<endl;
   }
   getch();
}

Contoh 2

                                                                            Lampiran Contoh 2 sofware Borland C++

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

void main(){
//Nama: Muhamad Syarif Ramadhan
//Nim : 3420227001

puts("=========================");
   puts("  Program For Bersarang  ");
   puts("=========================");
   int a,b;
   for (a=1;a<=2;a++){
    for (b=1;b<=2;b++){
      printf("Latihan Algoritma\n");
      }
   }
   getch();
}

Contoh 3


                                                            Lampiran Contoh 3 sofware Borland C++

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

void main(){
//Nama: Muhamad Syarif Ramadhan
//Nim : 3420227001

int a,b;
   for(a=1;a<=8;a++){
    printf("\n");
      for(b=a;b<=8;b++){

      printf("%d",a);
   }
 }
 getch();
}

Contoh 4


                                                            Lampiran Contoh  4 sofware Borland C++

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

void main(){
//Nama: Muhamad Syarif Ramadhan
//Nim : 3420227001

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\n Ingin Hitung Lagi [Y/T]:");
   lagi=getche();
   if(lagi=='Y'|| lagi=='y'){goto atas;}
   getch();
}

Contoh 5


                                                            Lampiran Contoh  5 sofware Borland C++

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

void main ()
{
//Nama : Muhamad Syarif Ramadhan
//NIM : 3420227001

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

Contoh 6


                                                            Lampiran Contoh  6 sofware Borland C++

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

void main ()
{
//Nama : Muhamad Syarif Ramadhan
//NIM  : 3420227001

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

Contoh 7


                                                            Lampiran Contoh  7 sofware Borland C++

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

void main ()
{
//Nama : Muhamad Syarif Ramadhan
//NIM  : 3420227001

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

Contoh 8


                                                            Lampiran Contoh  8 sofware Borland C++


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


void main ()
{
//Nama : Muhamad Syarif Ramadhan
//NIM  : 3420227001

    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();
}
                                                 Sekian dan Terimakasih
                                             Wassalamualaikum wr.wb

Friday, October 14, 2022

Algoritma dan Struktur Data Pertemuan 5

 Assalamualaikum wr.wb                                                                                                                                                                                                                 


Nama: Muhamad Syarif Ramadhan
Nim  : 3420227001
Prodi: Teknik Informatika

Contoh 1


                                                            Lampiran Contoh 1 sofware Borland C++

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

void main(){

//Nama : Muhamad Syarif Ramadhan
//Nim  : 3420227001

char kode,lagi;

atas:
clrscr();
   cout<<"Masukan Kode Menu Makanan [A/B/C]";
   kode =getche();
   cout<<'\n';
   switch (kode){
    case'A':case 'a':
      cout<<"Ayam Bakar"; break;
      case'B':case 'b':
      cout<<"Nasi Goreng"; break;
      case'C':case 'c':
      cout<<"Soto Betawi"; break;
      default:
      cout<<"Anda Salah Masukan Kode";
   }
   cout<<'\n';
   cout<<"\nIngin Pilih Lagi [Y/T]:";
   lagi=getche();
   if(lagi=='Y'||lagi=='y')goto atas;
   getch();
}

Contoh 2

                                                                            Lampiran Contoh 2 sofware Borland C++

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

void main(){
//Nama : Muhamad Syarif Ramadhan
//Nim  : 3420227001

   char kode,lagi; char menu[50],bonus[50];
   int jml; float harga,total,pot,ppn,grand;
lagi:
clrscr();
   printf("Masukan Menu Makanan[1/2/3]:");cin>>kode;
   printf("Jumlah Pembelian Makanan   :");cin>>jml;
   switch(kode){
    case '1':
      strcpy(menu,"Combo Fire Chicken");harga=35000;
         break;
      case '2':
      strcpy(menu,"Combo Fire Wings");harga=33000;
         break;
      default:
      strcpy(menu,"Combo Duo Fire Chicken");harga=50000;
   }
   total=harga*jml;ppn=0.1*total;

   if(jml>5){
    strcpy(bonus,"Tumbler");
      pot=0.1*total;
   } else {
    strcpy(bonus,"Maaf Tidak Dapat Bonus");
      pot=0;
   }
   grand=total+ppn-pot;
   clrscr();
   puts("           RICHEESE FACTORY");
   puts("         Jl.Pekayon Raya No.106");
   puts("====================================");
   cout<<"Menu Makanan  :"<<menu<<endl;
   cout<<"Harga Menu    :"<<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<<"        Ingin Pesan Lagi.?";cin>>lagi;
   if (lagi== 'Y' || lagi=='y'){goto lagi;}
   getch();

}

Contoh 3


                                                            Lampiran Contoh 3 sofware Borland C++

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

void main(){
//Nama : Muhamad Syarif Ramadhan
//Nim  : 3420227001

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

awal:

clrscr();
   puts("HOTEL BINTANG LIMA");
   puts("===================================");
   cout<<"Nama Penyewa        :";cin>>nama;
   cout<<"Kode Kamar [S/T/D]  :";cin>>kode;

   if (kode=='S' || kode=='s')
   {
    strcpy(tipe,"Single Room");
      harga=200000;
   }
   else if (kode=='T' || kode=='t')
   {
      strcpy(tipe,"Twim Room");
      harga=300000;
   }
   else if (kode=='D' || kode=='d')
   {
    strcpy(tipe,"Double Room");
      harga=450000;
   }
   else
   {
    puts("============================");
      cout<<"Kode Kamar Yang Anda Masukan Salah, Silahkan Input lagi";
      cin>>lagi;
      switch(lagi)
      {
      case'Y':
         case'y':
          goto awal;
         default:
          goto akhir;
      }
   }

   clrscr();
   puts("HOTEL BINTANG LIMA");
   puts("============================");
   cout<<"Nama Penyewa      :"<<nama<<endl;
   cout<<"Kode Kamar [S/T/D]:"<<kode<<endl;
   cout<<"Lama Menginap     :";cin>>lama;
   puts("============================");

   if(lama>=7)
   {
    strcpy(souvenir,"Tas Ransel");
   }
   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();
}

                                                Sekian dan Terimakasih
                                             Wassalamualaikum wr.wb

Sunday, October 2, 2022

Algoritma dan Struktur Data Pertemuan 4

  Assalamualaikum wr.wb                                                                                                                                                                                                                 


Nama: Muhamad Syarif Ramadhan
Nim  : 3420227001
Prodi: Teknik Informatika

Contoh 1


                                                            Lampiran Contoh 1 sofware Borland C++

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

void main() {
//Nama : Muhamad Syarif Ramadhan
//Nim : 3420227001

int absen,tugas,uts,uas;
   float total;
   puts("Program Menghitung Nilai Mahasiswa");
   puts("++++++++++++++++++++++++++++++++++");
   printf("Masukan Nilai Absen:");scanf("%d",&absen);
   printf("Masukan Nilai Tugas:");scanf("%d",&tugas);
   printf("Masukan Nilai UTS:");scanf("%i",&uts);
   printf("Masukan NIlai UAS:");scanf("%I",&uas);
total=(absen*0.1)+(tugas*0.2)+(uts*0.3)+(uas*0.4);
   puts("++++++++++++++++++++++++++++++++++");
   printf("Total Adalah:%.2f(Bentuk Tidak Terformat)\n",total);
   printf("Total Adalah:%.2f(Bentuk Yang Terhormat)\n",total);
   puts("++++++++++++++++++++++++++++++++++");
   if (total>=75)
   {cout<<"Selamat Kamu Lulus.";}
   else
   {cout<<"Maaf Kamu Tidak Lulus.";}
   getch();
   }

Contoh 2

                                                                            Lampiran Contoh 2 sofware Borland C++




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

void main(){

// Nama : Muhamad Syarif Ramadhan
// Nim  : 3420227001


      int pilih;
      char huruf [20];
      printf ("Silakan Pilih Program [1/2]:") ; cin >> pilih;
      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 [] = "Z";
char a2 [] = "z";
char b1 [] = "Z";
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();
    }
}

Contoh 3


                                                            Lampiran Contoh 3 sofware Borland C++

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

void main(){

// Nama : Muhamad Syarif Ramadhan
// Nim  : 3420227001

char gol,jab[10];
long gapok;
   cout<<endl<<"Data Jabatan"<<endl
<<"++++++++++++++++++++++++++"<<endl;
cout<<"Masukan Golongan [1/2]: ";cin>>gol;
if(gol=='1'){
strcpy(jab,"Manajer");
gapok=6000000;
}
else if(gol=='2'){
strcpy(jab,"Karyawan");
gapok=4500000;
}
else{
printf("Golongan %c tidak terdaftar.\n",gol);
strcpy(jab,"None");
gapok=0;
}
cout<<"Jabatan = "<<jab<<endl;
cout<<"Gaji Pokok = "<<gapok<<endl;
getch();
   }

Contoh 4


                                                            Lampiran Contoh 4 sofware Borland C++
#include <stdio.h>
#include <iostream.h>
#include <conio.h>

void main(){

// Nama : Muhamad Syarif Ramadhan
// Nim  : 3420227001

char kode,ukuran,merk[15]="None";
long harga=0;
cout<<"Kode Baju [1/2] : ";cin>>kode;
cout<<"Ukuran [S/M] : ";cin>>ukuran;
if (kode=='1'){
    strcpy(merk, "Converse");
if (ukuran=='S' || ukuran == 's') {harga=200000;} else {harga=210000;}
}
else if (kode=='2'){
strcpy(merk,"Nike");
//Bentuk penulisan if versi singkat
if (ukuran=='S' || ukuran == 's') harga=600000; else harga=610000;
   }
else{
cout<<"Salah Kode Baju"<<endl;
}
cout<<"Merk Baju :"<<merk<<endl;
cout<<"Harga Baju :"<<harga<<endl;
getch();
}
                                                  
                                                  Sekian dan Terimakasih
                                             Wassalamualaikum wr.wb