Advertisement
Guest User

czytanieztab

a guest
Nov 27th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #define ROZMIAR 10
  6.  
  7. int main () {
  8.  
  9. int i, liczba_el;
  10. int tablica_el[ROZMIAR];
  11.  
  12. // Czytamy elementy petla while
  13.  
  14.  
  15. i = 0;
  16. cout << "Podaj el. nr 1: ";
  17. cin >> tablica_el[i];
  18. i++;
  19.  
  20. while ( i < ROZMIAR && tablica_el[i-1]!= 0 ) {
  21. cout << "Podaj el. nr " << i+1 << " : ";
  22. cin >> tablica_el[i];
  23. i++;
  24. }
  25. if ( tablica_el[i-1] == 0 ) liczba_el = i - 1;
  26. else liczba_el = i;
  27.  
  28. cout << "Przeczytano : " << liczba_el << endl;
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement