Advertisement
AndriikoM

Лекція 3, завдання 2

Oct 20th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     int a[10];
  8.     int b;
  9.     int d;
  10.     for (int i=0; i<10; i++)
  11.     {
  12.         a[i]=0;
  13.     }
  14.     while (1)
  15.     {
  16.         cout << "vvedite nomer carti,vid 0 do 9: ";
  17.         cin >> b;
  18.         if (b>-1 & b<10)
  19.         {
  20.             cout << "vvedite sumy ";
  21.             cin >> d;
  22.             a[b]=a[b]+d;
  23.             for (int i=0; i<10; i++)
  24.                 {
  25.                     cout << a[i] << " ";
  26.                 }
  27.             cout << endl;
  28.         }
  29.         else
  30.             cout << "ne virno vvedenii nomer" << endl;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement