Minggu, 02 Oktober 2022

Tugas 3 (Pertemuan 4) Algoritma dan Struktur Data

 

Algoritma & Struktur Data

Tugas 3 Progaming Basic Algoritma

 

Assalamualaikum Wr. Wb.

Nama      : Aufa Munadil Al - Khoir
NIMa      : 3420210024
Prodi       : Teknik Informatika
Fakultas  : Sains dan Teknologi


Lampiran Tugas 3 Algoritma & Struktur Data

Example 1
Program_Menghitung_Nilai_Mahasiswa

Script Ex 1

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

void main ()
{
   //Keterangan_Variable          //Nama  : Aufa Munadil Al - Khoir
   int absen, tugas, uts, uas;    //NIM   : 3420210024
   float total;                   //Prodi : Teknik Informatika

   printf ("\t////////////////////////////////////////////\n");
   puts ("\t//// Program_Menghitung_Nilai_Mahasiswa ////");
   printf ("\t////////////////////////////////////////////\n");

   cout<<endl;
   printf ("\tInput_Value_Absen : "); scanf("%d",&absen);
   printf ("\tInput_Value_Tugas : "); scanf("%i",&tugas);
   cout <<"\tInput_Value_UTS  : "; cin>>uts;
   cout <<"\tInput_Value_UAS : "; cin>>uas;

   cout<<endl;
   //Proses_Penghitungan
   total = (absen*0.1)+(tugas*0.2)+(uts*0.3)+(uas*0.4);

   puts  ("\t############################################");
   cout <<"\tTotal_Adalah : "<<total<<" (Non_Format)\n";
   printf ("\tTotal_Adalah      : %.2f (Format)\n",total);
   puts ("\t############################################\n");

   //Kondisi
   if (total >=75)
   { cout<<"\tCongratulations"<<endl; }
   else
   { cout<<"\tSorry_You_Didn't_Pass"<<endl; }

   cout <<"\t\t\t\t\tCreate By  :"<<endl;
   printf ("\t********************************************\n");
   cout <<"\t*******   Aufa Munadil Al - Khoir    *******" <<endl;
   cout <<"\t*******          3420210024          *******" <<endl;
   cout <<"\t*******      Teknik Informatika      *******" <<endl;
   cout <<"\t******* project-s-khopi.blogspot.com *******" <<endl;
   printf ("\t********************************************\n");

   getch();
}

Example 2
Programs_1_Strlen

Programs_2_Strcmp


Script Ex 2

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

void main ()
{                                //Nama  : Aufa Munadil Al - Khoir
   int pilih;                    //NIM   : 3420210024
   char huruf[92];               //Prodi : Teknik Informatika
   cout<<endl;
   printf("\t\t# # # # # # # # # # # # # # # # # # # # # # # # # #\n");
   printf("\t   Choice_Your_Programs [1/2]: ");cin>>pilih;
   //scanf("%d",&pilih);

   if (pilih == 1)
   {
      clrscr();
      puts ("\t\t# # # # # # # # # # # # # # # # # # # # # # # # # #");
      puts ("\t\t# # # # # # # Example_Strlen_Programs # # # # # # #");
      puts ("\t\t# # # # # # # # # # # # # # # # # # # # # # # # # #");
      cout <<endl;
      cout <<"\t\tInput_Text          = ";gets(huruf);
      cout <<"\t\tEntered_Text_Lenght = "<<strlen(huruf);
      cout <<endl<<endl;
      cout <<"\t\t\t\t\t\t\t Create By:"<<endl;
      printf("\t\t* * * * * * * * * * * * * * * * * * * * * * * * * *\n");
      cout   <<"\t\t* * * * *  'project-s-khopi.blogspot.com  * * * * *"<<endl;
      printf("\t\t* * * * * * * * * * * * * * * * * * * * * * * * * *\n");

      getch();
   }

else if (pilih == 2)
   {
      clrscr();
      puts ("\t\t$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $");
      puts ("\t\t$ $ $ $ $ $ $ Example_Strcmp_Programs $ $ $ $ $ $ $");
      puts ("\t\t$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $");
      char f1[] = "f";
      char f2[] = "F";
      char f3[] = "f";
      cout <<endl;
      cout <<"\t Hasil Perbandigan "<<f1<<" dan "<<f2<<"-> ";
      cout <<strcmp (f1,f2)<<endl;
      cout <<"\t Hasil Perbandigan "<<f2<<" dan "<<f1<<"-> ";
      cout <<strcmp (f2,f1)<<endl;
      cout <<"\t Hasil Perbandigan "<<f1<<" dan "<<f3<<"-> ";
      cout <<strcmp (f1,f3)<<endl;
      cout <<endl;
      printf("\t\t* * * * * * * * * * * * * * * * * * * * * * * * * *\n");
      cout   <<"\t\t* * * * *  'project-s-khopi.blogspot.com  * * * * *"<<endl;
      printf("\t\t* * * * * * * * * * * * * * * * * * * * * * * * * *\n");
      getch();
   }
   else
   {
      printf("\t    Sorry_Your_Choice_Is_Wrong");
      getch();
   }
}

Example 3
Program_Biaya_Kuliah
Menggunakan_String_Strcpy

Script Ex 3

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

void main()
{                                 //Nama : Aufa Munadil Al - Khoir
   char type,faculty[29];         //NIM  : 3420210024
   long spp;                      //Prodi: Teknik Informatika

   cout<<endl;
   cout <<"\tX X X X X X X X X X X X X X X X X X"<<endl;
   cout  <<"\tX X X X X   Faculty_Fee   X X X X X"<<endl;
   cout <<"\tX X X X X X X X X X X X X X X X X X"<<endl;
   cout <<"\t    Input_Your_Type [F/K/U]: ";cin>>type;
   if(type=='F')
   {
      strcpy(faculty,"Science and Technology");
      spp=21000000;
   }
   else if(type=='K')
   {
      strcpy(faculty,"Health Sciences");
      spp=27300000;
   }
   else if(type=='U')
   {
      strcpy(faculty,"Islamic Economics_n_Business Law");
      spp=27300000;
   }
   else
   {
      printf("\tFaculty_%c_not_Registerd.\n",type);
      strcpy(faculty,"None");
      spp=999999999;
   }
   cout <<"\tType    : "<<type<<endl;
   cout <<"\tFaculty : "<<faculty<<endl;
   cout <<"\tSPP    : "<<spp<<endl;

   cout<<endl;
   cout  <<"\t\t\t\tCreate By :"<<endl;
   printf ("\t* * * * * * * * * * * * * * * * * *\n");
   cout <<"\t*  'project-s-khopi.blogspot.com  *" <<endl;
   printf ("\t* * * * * * * * * * * * * * * * * *\n");
   getch();
}

Example 4
Program_Memilih_Ukuran_Baju


Script Ex 4

#include <stdio.h>         //Nama  : Aufa Munadil Al - Khoir
#include <conio.h>         //NIM   : 3420210024
#include <iostream.h>      //Prodi : Teknik Informatika

void main()
{

   printf ("\t********************************************\n");
   cout   <<"\t******** 'Clothes_Choosing_Programs ********" <<endl;
   printf ("\t********************************************\n");

   char code, size, merk[15]="None";
   long harga=0;
   cout <<"\tChoice_Code [1/2/3] : ";cin>>code;
   cout <<"\tChoice_Size [S/L/XL] : ";cin>>size;
   if (code=='1')
   {
      strcpy(merk,"KIRA");
      if (size=='S' || size =='s') { harga=754200; } else { harga=949000; }

      strcpy(merk,"KIRA");
      if (size=='L' || size =='l') { harga=885100; } else { harga=989000; }

      strcpy(merk,"KIRA");
      if (size=='XL' || size =='xl') { harga=994200; } else { harga=1249000; }
   }
   else if (code=='2')
   {
      strcpy(merk,"FYZ");
      //Bentuk penulisan if versi singkat
      if (size=='S' || size == 's') harga=130000; else harga=178900;

      strcpy(merk,"FYZ");
      if (size=='M' || size == 'm') harga=700000; else harga=892000;

      strcpy(merk,"FYZ");
      if (size=='XL' || size == 'xl') harga=521000; else harga=950900;
   }
   else if (code=='3')
   {
      strcpy(merk,"ARAH");
      if (size=='S' || size =='s') { harga=890200; } else { harga=1800100; }

      strcpy(merk,"ARAH");
      if (size=='M' || size == 'm') harga=700000; else harga=892000;

      strcpy(merk,"ARAH");
      if (size=='S' || size =='s') { harga=582000; } else { harga=840200; }
   }
   else
   {
    cout<<"\tWrong_Dress_Code"<<endl;
   }
   cout <<"\tMerk Baju            : "<<merk<<endl;
   cout <<"\tHarga Baju          : "<<harga<<endl;

   cout <<"\t\t\t\t\tCreate By  :"<<endl;
   printf("\t********************************************\n");
   cout <<"\t******* project-s-khopi.blogspot.com *******" <<endl;
   printf("\t********************************************\n");
   getch();
}

Terima Kasih
Wassalamu'alaikum Wr. Wb.

Tidak ada komentar:

Posting Komentar

Tugas 13 (Pertemuan 14) Algoritma dan Struktur Data

  Algoritma dan Struktur Data Tugas 13 Programing Basic Algoritma Assalamu'alaikum Wr. Wb. Nama        : Aufa Munadil Al - Khoir NIM a  ...