systemxr00t

Untitled

Apr 2nd, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. // Program input 2 Bilangan integer
  2. #include<iostream>
  3. using namespace std;
  4.  
  5. int main(){
  6.     char input = 'y';
  7.     int bil1[5];
  8.     int bil2[5];
  9.     int hasil[5];
  10.     int max=1;
  11.     int index;
  12.     index=0;
  13.     cout << "Program Input Bilangan [max 5 kali pengulangan]\n";
  14.     while(input=='y'||input=='Y'){
  15.         cout <<"Pertambahan -- "<<max++<<endl;
  16.         cout << "Bilangan 1 : \t";
  17.         cin >> bil1[index];
  18.         cout << "Bilangan 2 : \t:";
  19.         cin >> bil2[index];
  20.         hasil[index]=bil1[index]+bil2[index];
  21.         index+=1;
  22.         if (max==6)
  23.             break;
  24.         cout << "\nHasil tersimpan...\nIngin menginput lagi?(y/n) : ";
  25.         cin>> input;
  26.         }
  27.         index = 1;
  28.         cout << endl<<endl;
  29.         for(int i=0;i<max-1;i++){
  30.             cout << "Hasil penjumlahan ke - "<<index++
  31.             <<": "<< hasil[i]<<endl;           
  32.         }
  33.     }
Add Comment
Please, Sign In to add comment