program tukar bilangan
#include <cstdlib>
#include <iostream>
using namespace std;
void tukar(int& A,int& B){
int temp = A;
A = B;
B = temp;
}
int main(int argc, char *argv[])
{
int bil1,bil2;
cout<<"Masukkan bilangan 1:";cin>>bil1;
cout<<"Masukkan bilangan 2:";cin>>bil2;
tukar(bil1,bil2);
cout<<"bilangan 1 ="<<bil1<<endl;
cout<<"bilangan 2 ="<<bil2<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Komentar
Posting Komentar