Advertisement
evgenko

Untitled

Jun 5th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void clean_messiv(int a[],int n)
  5. {
  6.     for (int i=0;i<n;i++)
  7.         a[i]=0;
  8. }
  9. void vivod_sumu(int a[],int n)
  10. {
  11.     int suma=0;
  12.     for (int i=0;i<n;i++)
  13.     {
  14.         suma+=a[i];
  15.         cout << a[i] << " ";
  16.     }
  17.     cout<< endl<< "V sume na vseh cards: ";
  18.     cout<< suma << endl;
  19. }
  20. int main()
  21. {
  22.     int cards[10];
  23.     int v = 1;
  24.     int summa;
  25.     int nomcards;
  26.     int polozh;
  27.  
  28.     clean_messiv(cards,10);
  29.  
  30.  
  31.     while (v == 1)
  32.     {
  33.         summa=0;
  34.         cout<<"Vvedi nomer card: ";
  35.         cin >> nomcards;
  36.         cout<< endl <<"Na skolko popolnit: ";
  37.         cin >> polozh;
  38.         cards[nomcards-1]+=polozh;
  39.         cout<< endl;
  40.         vivod_sumu(cards,10);
  41.  
  42.  
  43.     }
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement