Tugas 3 Pertemuan 4 Algoritma dan struktur data

 

Assalamualaikum wr.wb
Lampiran Tugas 3 Pertemuan 4 Progaming Basic Algoritma

Nama : Ihsan Muhammad Ramadhan
NIM    : 3420210032
Prodi  : Teknik Informatika

Lampiran Tugas 1 menggunakan software Borland C++


pseudo code in https://glot.io/new/cpp


//Nama     = Ihsan Muhammad Ramadhan
//NIM = 3420210032
//Prodi = Teknik Informatika

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

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 melanjutkan pendidikan!."; }

   else

   { cout<<"Tingkatkan lagi ya belajarnya!."; }

   getch();
}

Lampiran Tugas 2 "Progam Strlen dan Progam Strcmp" menggunakan software Borland C++




 

pseudo code in https://glot.io/new/cpp

//Nama   = Ihsan Muhammad Ramadhan
//NIM    = 3420210032
//Prodi  = Teknik Informatika

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

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

   printf("Silahkan 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 problems is that of leaving characters in the buffer.
     Sumber: http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?anever-1043372399sid=1043284385
  */
  if (pilih == 1)
  {
     clrscr();
     puts("=====================================");
     puts("\tContoh Program Strlen");
     puts("=====================================");
     cout<<"Masukan Sembarang Kata = ";gets(huruf);
     cout<<"Panjang Kata Yang Diinputkan = "<<strlen(huruf);
     getch();
}

else if (pilih == 2)
  {
     clrscr();
     puts("=====================================");
     puts("\tContoh 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 anda salah..");
getch();
  }

}

Lampiran Tugas 3 menggunakan software Borland C++





pseudo code in https://glot.io/new/cpp


//Nama   = Ihsan Muhammad Ramadhan
//NIM     = 3420210032
//Prodi    = Teknik Informatika

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

void main()
{
   char frame,machine[29];
   long biaya;
   cout<<endl<<"Make a frame Chopper Motorcycle "<<endl
    <<"********************************** "<<endl;
   cout<<"Masukan No frame yang kamu inginkan [1/2]: ";cin>>frame;
   if(frame=='1')
   {
      strcpy(machine,"Kawasaki Binter");
      biaya=17000000;
   }
   else if(frame=='2')
   {
      strcpy(machine,"Yamaha Scorpio");
      biaya=9000000;
  }
   else
   {
      printf("Frame %c tidak terdaftar.\n",frame);
      strcpy(machine,"Tossa");
      biaya=0;
   }
   cout<<"No frame = "<<frame<<endl;
   cout<<"Machine = "<<machine<<endl;
   cout<<"Biaya buruh = "<<biaya<<endl;
   getch();
}


Lampiran Tugas 4 menggunakan software Borland C++





pseudo code in https://glot.io/new/cpp

//Nama    = Ihsan Muhammad Ramadhan
//NIM     = 3420210032
//Prodi   = Teknik Informatik

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

void main()
{
   cout<<endl<<"Come For Buy, Buy for Happy "<<endl
    <<"********************************** "<<endl;
   char catalog,size,brand[15]="None";
   long price=0;
   cout<<"No Catalog [1/2] : ";cin>>catalog;
   cout<<"Size [S/M] : ";cin>>size;
   if(catalog=='1')
   {
      strcpy(brand," THXNSMN");
      if (size=='S' || size =='s') { price=99000; } else { price=99000; }
   }
   else if(catalog=='2')
   {
     strcpy(brand," Vearst");
     //Bentuk penulisan if versi singkat
     if (size=='M' || size =='m') price=120000; else price=120000;
  }
   else
   {
      cout<<"sorry wrong catalog"<<endl;
   }
   cout<<"brand catalog : "<<brand<<endl;
   cout<<"brand price : "<<price<<endl;
   getch();
}


Sekian dan Terima Kasih.
Wassalamualaikum wr.wb



Komentar

Postingan Populer