Senin, 14 Mei 2012

Kalkulator Sederhana Dev C++

Hallo Kawan Momod and Mimin yang saya Sayangi....

Momod=Sahabat Laki
Mimin=Sahabat Perempuan

Kali ini dan hari ini juga saya akan meng-Share beberapa Ilmu saya hahahaha...(sok Pinter deh.. >.<)

ya udah langsung aja yah Cek It Out..

Kalkulator Sederhana Dengan Dev C++ :

#include <cstdlib>
#include <iostream>
#include <math.h>
#include <cmath>

using namespace std;
class kalkulator{

      public:
             void pemilihan();
             void akar();
             void pangkat();
             void Perkalian();
             void Pembagian();
             void Penjumlahan();
             void Pengurangan();
             void cacos();
             void catan();
             void cexp();
             void clog();
     private:
              float a,b,hasil;
     };

void kalkulator::pemilihan(){
     int p;
     cout<<"                ======================="<<endl;
     cout<<"                ===>>My Calculator<<==="<<endl;
     cout<<"                ======================="<<endl;
     cout<<endl;
     cout<<"======================================================="<<endl;
     cout<<"====Daftar Operasi Perhitungan Dalam Kalkulator Ini===="<<endl;
     cout<<"======================================================="<<endl;
     cout<<endl;
     cout<<"1.Akar    \t\t6.Pengurangan\n";
     cout<<"2.Pangkat        \t7.acos\n";
     cout<<"3.Perkalian\t\t8.atan\n";
     cout<<"4.Pembagian\t\t9.exponen\n";
     cout<<"5.Penjumlahan\t\t10.Log\n";
     cout<<endl;
     cout<<"Masukan Nomor Operator Yang Anda Inginkan : ";
     cin>>p;
     system ("cls");
     switch(p){
               case 1 : akar();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 2 : pangkat();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 3 : Perkalian();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 4 : Pembagian();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 5 : Penjumlahan();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 6 : Pengurangan();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 7 : cacos();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 8 : catan();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 9 : cexp();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               case 10: clog();
               cout<<"======================================================"<<endl;
               cout<<"=======Created Design By : Arvin Janathan Adhim======="<<endl;
               cout<<"======================================================"<<endl;
               system ("PAUSE");system ("cls");
     return pemilihan();break;
               default:
                       cout<<"Anda memilih nomer yang salah......!!!"<<endl;
                       cout<<"silahkan coba lagi"<<endl;
                       system ("PAUSE");system ("cls");
     return pemilihan();break;}
                       }

void kalkulator::akar(){
     cout<<"            *****************************"<<endl;
     cout<<"            ==Anda memilih operasi Akar=="<<endl;
     cout<<"            *****************************"<<endl;
     cout<<endl;
     cout<<"Masukan angka untuk akar : ";
     cin>>a;
     hasil=sqrt(a);
     cout<<"Hasil Akar               : "<<hasil<<endl;

     }
void kalkulator::pangkat(){
     cout<<"               ******************************"<<endl;
     cout<<"               =Anda memilih operasi Pangkat="<<endl;
     cout<<"               ******************************"<<endl;
     cout<<endl;
     cout<<"Masukan angka yang dipangkatkan : ";
     cin>>a;
     cout<<"Masukan angka untuk pangkatnya  : ";
     cin>>b;
     hasil=pow(a,b);
     cout<<"Hasil Pangkat                   : "<<hasil<<endl;

     }
void kalkulator::Perkalian(){
     cout<<"              **********************************"<<endl;
     cout<<"              ==Anda memilih operasi Perkalian=="<<endl;
     cout<<"              **********************************"<<endl;
     cout<<endl;
     cout<<"Masukan Angka Pertama : ";
     cin>>a;
     cout<<"Masukan Angka Kedua   : ";
     cin>>b;
     hasil=a*b;
     cout<<"Hasil Perkalian       : "<<hasil<<endl;

     }
void kalkulator::Pembagian(){
     cout<<"               ********************************"<<endl;
     cout<<"               =Anda memilih operasi Pembagian="<<endl;
     cout<<"               ********************************"<<endl;
     cout<<endl;
     cout<<"Masukan Angka Pertama : ";
     cin>>a;
     cout<<"Masukan Angka Kedua   : ";
     cin>>b;
     hasil=a/b;
     cout<<"Hasil Pembagian       : "<<hasil<<endl;

     }
void kalkulator::Penjumlahan(){
     cout<<"              *********************************"<<endl;
     cout<<"              =Anda memilih opersi Penjumlahan="<<endl;
     cout<<"              *********************************"<<endl;
     cout<<endl;
     cout<<"Masukan Angka Pertama : ";
     cin>>a;
     cout<<"Masukan Angka Kedua   : ";
     cin>>b;
     hasil=a+b;
     cout<<"Hasil Penjumlahan     : "<<hasil<<endl;

     }
void kalkulator::Pengurangan(){
     cout<<"             **********************************"<<endl;
     cout<<"             =Anda memilih operasi Pengurangan="<<endl;
     cout<<"             **********************************"<<endl;
     cout<<"Masukan Angka Pertama : ";
     cin>>a;
     cout<<"Masukan Angka Kedua   : ";
     cin>>b;
     hasil=a-b;
     cout<<"Hasil Pengurangan     : "<<hasil<<endl;

     }
void kalkulator::cacos(){
     cout<<"             *****************************"<<endl;
     cout<<"             ==Anda memilih operasi acos=="<<endl;
     cout<<"             *****************************"<<endl;
     cout<<"Masukan inputan untuk acos : ";
     cin>>a;
     hasil=acos(a);
     cout<<"hasil acosnya adalah       : "<<hasil<<endl;

     }
void kalkulator::catan(){
     cout<<"             *****************************"<<endl;
     cout<<"             ==Anda memilih operasi atan=="<<endl;
     cout<<"             *****************************"<<endl;
     cout<<"Masukan inputan untuk atan : ";
     cin>>a;
     hasil=atan(a);
     cout<<"hasil atannya adalah       : "<<hasil<<endl;

     }
void kalkulator::cexp(){
     cout<<"            ******************************"<<endl;
     cout<<"            =Anda memilih operasi exponen="<<endl;
     cout<<"            ******************************"<<endl;
     cout<<"Masukan inputan untuk exponen : ";
     cin>>a;
     hasil=exp(a);
     cout<<"hasil exponennya adalah       : "<<hasil<<endl;

     }
void kalkulator::clog(){
     cout<<"            ****************************"<<endl;
     cout<<"            ==Anda memilih operasi Log=="<<endl;
     cout<<"            ****************************"<<endl;
     cout<<"Masukan Angka : ";
     cin>>a;
     hasil=log(a);
     cout<<"Hasil Log     : "<<hasil<<endl;

     }                
int main()
{
    kalkulator x;
    x.pemilihan();
    system("PAUSE");
    return EXIT_SUCCESS;
}

Semoga Syntax Code di atas Membantu Momod and Mimin Sekalian

Jangan Lupa Kasih Komentar kalau Belum Paham OKe... Follow Juga yah Blog ku ini... >.<

Kalkulator Sederhana Dev C++ Rating: 4.5 Diposkan Oleh: Unknown

1 komentar:

  1. ahh iku copas dari situs apa gan, awas ntar ktauan yang punya gmana...? :p

    Don't be PLAGIAT, hehehehe... :p

    BalasHapus

Translate