Program Tukar

berikut merupakan contoh program tukar menggunakan c++ (DEV)
#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;
}
Posted in c++

komentar

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

calender lalu
April 2013
T W T F S S M
« Mar    
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Information
081-917- 166-???
Lunch: 11am - 2pm
Dinner: M-Th 5pm - 11pm, Fri-Sat:5pm - 1am
%d bloggers like this: