Advertisement
Guest User

rozdzial 17

a guest
Nov 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int wczytajLiczbe()
  4. {
  5.     int a;
  6.     int liczba;
  7.     cin >> liczba;
  8.     cout << "Podaj ja jeszcze raz: ";
  9.     cin >> a;
  10.     if ( a == liczba )
  11.         {
  12.             return (liczba);
  13.         }
  14.     else ( a != liczba );
  15.     do
  16.     {
  17.      cout << "Podaj poprawna liczbe ";
  18.      cin >> a;
  19.     } while ( a != liczba );
  20. }
  21.  
  22. int main()
  23. {
  24.     cout << " Nasz program wczytuje liczby ze standardowego wejscia i zwraca podana wartosc " << endl;
  25.     cout << "\nPodaj liczbe: ";
  26.     int liczba = wczytajLiczbe();
  27.     cout << "Podales liczbe: " << liczba << endl;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement