Posted by : deari q
Selasa, 11 Maret 2014
#include <iostream>
#include <cstdlib>
using namespace std;
class Tukar{
public :
void input();
void proses();
void output();
private :
int a;
int b;
int c;
};
void Tukar :: input() {
cout<<"masukkan nilai A = ";
cin>>a;
cout<<"masukkan nilai B = ";
cin>>b;
}
void Tukar :: proses() {
c = a;
a = b;
b = c;
}
void Tukar :: output () {
cout<<" setelah di tukar "<<endl;
cout<<"nilai A = "<< a <<endl;
cout<<"nilai B = "<<b <<endl;
}
int main(){
Tukar run ;
run.input();
run.proses();
run.output();
system("PAUSE");
return 0;
}