This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Rabu, 16 Oktober 2013

KALKULATOR SEDERHANA


#include<iostream>
#include<constrea.h>
#include<cstring>
main()

{

float x,y,hasil;
   cout<<"kalku"<<endl<<endl;
   cout<<"daftar operator aritmatika :"<<endl;
   string jumlah ="(1) penjumlahan";
   cout<<jumlah<<endl;
   string pengurangan="(2) pengurangan";
   cout<<pengurangan<<endl;
   string pembagian="(3) pembagian";
   cout<<pembagian<<endl;
   string perkalian="(4) perkalian";
   cout<<perkalian<<endl<<endl;

   cout<<"masukan nilai 1 = ";
   cin>>x;
   cout<<"masukan nilai 2 = ";
   cin>>y;
a:
   int z;
   cout<<"masukan nomer operator aritmatika = ";
   cin>>z;

                if(z==1)
   {
                hasil = x+y;
                cout<<"hasil operasi"<<jumlah<<", "<<x<<" dan "<<y<<" = "<<hasil<<endl;
   }
   else if(z==2)
   {
                hasil = x-y;
      cout<<"hasil operasi"<<pengurangan<<", "<<x<<" dan "<<y<<" = "<<hasil<<endl;
   }
   else if(z==3)
   {
                hasil = x/y;
      cout<<"hasil operasi"<<pembagian<<", "<<x<<" dan "<<y<<" = "<<hasil<<endl;
   }
   else if(z==4)
   {
                hasil = x*y;
      cout<<"hasil operasi"<<perkalian<<", "<<x<<" dan "<<y<<" = "<<hasil<<endl;
   }
   else
   {
                cout<<"nomer operator aritmatika salah"<<endl<<endl;
                                goto a;
   }
getch();
}