Now you can Subscribe using RSS

Submit your Email

Jumat, 08 April 2016

DIKTAT BAB 2 NO 2

Unknown

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

using namespace std;
class bil{
       friend ostream& operator<<(ostream&, bil&);
      friend istream& operator>>(istream&, bil&);
   public:
    bil();
   
   private:
           int a,b;
      };
   bil::bil(){
       cout<<"----------------------------------------"<<endl;
      cout<<"Program Bilangan Rasional "<<endl;
      cout<<"-----------------------------------------"<<endl;
      }
   istream& operator>>(istream& in, bil& mlebu){
       cout<<"masukan Bilangan Ke 1 = ";
       in>>mlebu.a;
       cout<<"masukan Bilangan ke 2 = ";
       in>>mlebu.b;
      return in;
      }
   ostream& operator<<(ostream& out, bil& metu){
       cout<<"Keluaran = ";
       out<<metu.a<<" / "<<metu.b;;
      return out;
      }

   main(int argc, char** argv){
       bil x;
      cin>>x;
      cout<<x;
      getch();
   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