• Posted by : deari q Senin, 31 Maret 2014





    Algoritma


    Deklarasi

        A, B   :  integer
        Temp  : integer

    Deskripsi

        input  (A,B)
              Temp <== A
              A       <== B
              Temp <== B
       output (A, B)


    Program C++ biasa

    #include <cstdlib>
    #include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {  
    int A, B, temp;
        cout<<"Masukkan nilai pertama  = ";
        cin>>A;
        cout<<"Masukkan nilai kedua  = ";
        cin>>B;
       
              temp = A ;
              A      = B ;
              B      = temp ;
        
        cout<<endl<<endl;
        cout<<"== Setelah Ditukar =="<<endl;
        cout<<"nilai pertama = "<<A<<endl;
        cout<<"nilai kedua = "<<B<<endl;

        system("pause");
        return 0;
    }
    hasil run :



    Leave a Reply

    Subscribe to Posts | Subscribe to Comments

  • - Copyright © 2013 Kampus - To Aru Kagaku no Railgun - Powered by Blogger - Designed by Johanes Djogan -