About Me

Followers

Friday, July 29, 2011

program menghitung jarak 2 titik

#include

#include


using namespace std;

class Hitung (){

friend ostream& operator<<(ostream&, const Hitung&); friend istream& operator>>(istream&,Hitung&);

Public:

Hitung();

float jarak_2titik_X(){(hasilX(x1+x2)/2);}

float jarak_2titik_Y(){(hasilY(y1+y2)/2);}

private:

int x1,x2,y1,y2;
int jarak;
};
Hitung::Hitung(){
cout<<"program menghitung jarak 2 titik\n"; } istream& operator>>(istream& in,Hitung& masukan){
cout<<"masukan nilai x1:"; in>>masukan.x1;
cout<<"masukan nilai x2:"; in>>masukan.x2;
cout<<"masukan nilai y1:"; in>>masukan.y1;
cout<<"masukan nilai y2:"; in>>masukan.y2;
return in;
}

ostream& operator>>(ostream& out, const Hitung& keluarkan){
out>>"nilai x1 :"<<>"nilai x2 :"<<>"jarak titik X :"<<>"nilai y1 :"<<>"nilai y2 :"<<>"jarak titik Y :"<<>X;
X.jarak_2titik_X();
X.jarak_2titik_Y();
cout>>X;
system("PAUSE");
return EXIT_SUCCESS;
}

0 Komentar Terbaik

Post a Comment