Now you can Subscribe using RSS

Submit your Email

Jumat, 08 April 2016

DIKTAT BAB 2 NO 4

Unknown
#include <iostream>
using namespace std;

class hitung{
    
public:
   void masukan();
   void proses();
   void keluaran();
 
private:
    float x,y,hasil1,hasil2,hasil3,hasil4;
   };
 
void hitung::masukan(){
   cout<<"\t\t --->>>MEREPRESENTASIKAN OPERASI-OPERASI<<<--- \n";
   cout<<"\n\t\t\t\t -->>ARITMATIKA<<--\n";
   cout<<"\nMasukkan Nilai Ke- 1 : ";cin>>x;
   cout<<"Masukkan Nilai ke- 2 : ";cin>>y;
   cout<<endl;
   }
 
void hitung::proses(){
    hasil1=x+y;
    hasil2=x-y;
    hasil3=x*y;
    hasil4=x/y;
      }

void hitung::keluaran(){
   cout<<"Hasil : "<<x<<" + "<<y<<"= "<<hasil1<<endl;
   cout<<"Hasil : "<<x<<" - "<<y<<"= "<<hasil2<<endl;
   cout<<"Hasil : "<<x<<" * "<<y<<"= "<<hasil3<<endl;
   cout<<"Hasil : "<<x<<" : "<<y<<"= "<<hasil4<<endl;
   }

int main(){
   hitung bab2;
   char opsi;
   do{
   bab2.masukan();
   bab2.proses();
   bab2.keluaran();
   cout<<"\n\t-->>ULANGI LAGI y/n<<--\n";cin>>opsi;
   }
   while(opsi=='y');
   cout<<"\n\t--->>>TERIMAKASIH<<<---";
return 0;
}

Unknown / Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

0 komentar:

Posting Komentar

Coprights @ 2016, Blogger Templates Designed By Templateism | Distributed By Rika Nursita