Program Tukar

#include iostream;

using namespace std;

void tukar(int *A, int *B){
int temp;
temp=*A;
*A=*B;
*B=temp;
}

int main(){
int A,B;
cout<<"Masukkan nilai A = ";
cin>>A;
cout<<"Masukkan nilai B = ";
cin>>B;
cout<<"Sebelum ditukar"<<endl;
cout<<"A : "<<A<<endl;
cout<<"B : "<<B<<endl;
cout<<"Sesudah ditukar"<<endl;
tukar(A,B);
cout<<"A : "<<A<<endl;
cout<<"B : "<<B;
cout<<endl;
system("PAUSE");
return 0;
}

Baca Juga :   Algoritma dan Program Pombensin dengan C++