This is default featured post 1 title

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

This is default featured post 2 title

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

This is default featured post 3 title

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

This is default featured post 4 title

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

This is default featured post 5 title

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

Rabu, 29 September 2010

Praktikum sdata-rabu 09.00

Praktikum sdata-rabu 09.00

Nama      : Arif Aditia
Nim       : 09018294
postest   : Praktikum sdata

#include <cstdlib>
#include <iostream>

using namespace std;
class Bilangan{
friend ostream& operator<<(ostream&, const Bilangan&);
friend istream& operator>>(istream&, Bilangan&);
public:
Bilangan(int a0=0, float b0=0.0):a(a0),b(b0){}
void banding_int(const Bilangan&,const Bilangan&);
Bilangan& operator=(const Bilangan&);
Bilangan operator+(const Bilangan&)const;
Bilangan operator-()const;
private:
int a;
float b;
};
ostream& operator<<(ostream& out,const Bilangan& x){
out<<”Bagian integer :”<<x.a<<endl;
out<<”Bagian float :”<<x.b<<endl;
return out;
}
void Bilangan::banding_int(const Bilangan& x,const Bilangan& y){
if(x.a>y.a)cout<<x.a<<”::x lebih besar dari”<<y.a<<”::y”;
else cout<<x.a<<”::x lebih kecil dari”<<y.a<<”::y”;
}
Bilangan& Bilangan::operator=(const Bilangan& x){
a=x.a;
b=x.b;
return *this;
}
istream& operator>>(istream& in,Bilangan& x){
cout<<”\nMasukkan bagian integer :”;
in>>x.a;
cout<<”\nMasukkan bagian float :”;
in>>x.b;
return in;
}
Bilangan Bilangan::operator+(const Bilangan& x)const{Bilangan cc;
cc.a=a+x.a;
cc.b=b+x.b;
return cc;
}
Bilangan Bilangan::operator-()const{Bilangan x;
x.a=-a;
x.b=-b;
return x;
}

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More