Guest User

Untitled

a guest
Dec 13th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. //
  2. // main.cpp
  3. // 01
  4. //
  5. // Created by Petr Kalab on 03.10.12.
  6. // Copyright (c) 2012 Petr Kalab. All rights reserved.
  7. //
  8. // Sčítání čísel v poli
  9.  
  10.  
  11. #include <iostream>
  12.  
  13. using namespace std;
  14.  
  15. int main(int argc, const char * argv[])
  16. {
  17.  
  18. int i = 0;
  19. int x = 0;
  20. int y = 0;
  21. cout << "Zadej velikost pole ";
  22. cin >> i;
  23. int pole[i];
  24. for(int a=0; a<i;a++)
  25. {
  26. cout << "Zadej "<< a+1 << " cislo: ";
  27. cin >> x;
  28. pole[a] = x;
  29.  
  30. }
  31. for(int b=0;b<i;b++)
  32. {
  33. y = y + pole[b];
  34.  
  35.  
  36. }
  37.  
  38. cout << "Sečtená čísla v poli jsou: " << y;
  39.  
  40. return 0;
  41. }
Add Comment
Please, Sign In to add comment