Advertisement
Guest User

odwracanie

a guest
Mar 29th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string odwrocLiczbe(string number)
  6. {
  7. string nowy;
  8.  
  9. for(int a=number.length(); a>=0; a--)
  10. {
  11. nowy=nowy+number[a];
  12. }
  13.  
  14. return nowy;
  15.  
  16. }
  17.  
  18. int main() {
  19.  
  20.     string number;
  21.     cout <<"podaj liczbe: :" << endl;
  22.     cin >> number;
  23.     cout <<"liczba odwrotna to: " << odwrocLiczbe(number);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement