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

Tuesday, September 20, 2022

TUGAS MATERI PERTEMUAN 3

 Nama : Reza Hidayatulloh

Nim    : 3420210019

Prodi   :Teknik Informatika



 










Monday, September 12, 2022

TUGAS MATERI PERTEMUAN 2

 



Assalamualaikkum wr.wb

Lampiran Tugas Programming Basic Algoritma

Nama :Reza Hidayatulloh

Nim   :3420210019

Prodi :Teknik Informatika


Lampiran tugas 1 menggunakan software Borland C++


Pseudo code in Borland C++
#include <iostream.h>
#include <conio.h>

void main () {
   //Name : Reza Hidayatulloh
   //Nim  : 3420210019
   //Prodi: Teknik Informatika
   cout<<"this is my first C++ program.."<<endl;
   cout<<"Name : Reza Hidayatulloh"<<endl;
   cout<<"Nim  : 3420210019"<<endl;
   cout<<"Prodi: Teknik Informaika";
   getch();
}
Lampiran Tugas 2 menggunakan Software Borland C++
pseudo code in Borland C++

#include <iostream.h>
#include <conio.h>
#include <stdio.h>
/*
 Name  : Reza Hidayatulloh
 Nim   : 3420210019
 Prodi : Teknik Informatika
 */
 void main()
 {
   const float phi = 3.14;
   int finger =7;
   float area;
   printf("finger value is %d \n",finger);
   area = finger * finger * phi;
   printf("the area of the circle is %.2f",area);
   getch();
 }

Sekian dan Terima Kasih.
Wassalamualaikum wr.wb