C++ Penukaran Value

#include <iostream>
#include <conio>

main(){
int A[5]={5,22,7,10,1};
   int B[5]={16,5,9,2,3};
   int C[5];
   int i;
   cout<<" A = ";
   for(i=0;i<5;i++){
   cout<<A[i]<<" ";}
cout<<endl;

   cout<<" B = ";
   for(i=0;i<5;i++){
   cout<<B[i]<<" ";}
   cout<<endl;

   for(i=0;i<5;i++){
      C[i]=A[i];
      A[i]=B[i];
      B[i]=C[i];
   }
   cout<<"\n |*****************|";
   cout<<"\n | Hasil penukaran |";
   cout<<"\n |*****************|\n\n";

   cout<<" A = ";
   for(i=0;i<5;i++){
    cout<<A[i]<<" ";
   }
   cout<<endl;

   cout<<" B = ";
   for(i=0;i<5;i++){
    cout<<B[i]<<" ";
   }
getch();
}

0 Response to "C++ Penukaran Value"

Posting Komentar