Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdint.h>
  3. #include <cstdlib>
  4. #include <conio.h>
  5. #include <string>
  6. int main()
  7. {
  8. std::cout << "Zadanie 2" << '\n';
  9. int a, *b;
  10. char wyraz[30];
  11. std::cout << "Podaj wyraz (max 30liter) ";
  12. //std::string wyraz;
  13. std::cin >> wyraz;
  14. std::cout << "Co chcesz zrobic?" << '\n' << "1 - zamienic wszystkie litery na duze" << '\n' << "2 - zamienic wszystkie litery na male" << "3- pierw zamienic na male potem na duze" << 'n';
  15. std::cin >> a;
  16. int i = 0;
  17. int j = 0;
  18. switch (a)
  19. {
  20. case 1:
  21.  
  22. while (wyraz[i] != '\0') {
  23. if (wyraz[i]>95)
  24. std::cout << (char)(wyraz[i] - 32);
  25. else
  26. std::cout << wyraz[i];
  27. i++;
  28. }
  29. break;
  30.  
  31. case 2:
  32.  
  33. while (wyraz[j] != '\0') {
  34. if (wyraz[j]>95)
  35. std::cout << (char)(wyraz[j] - 32);
  36. else
  37. std::cout << (char)(wyraz[j] + 32);
  38. i++;
  39. }
  40. break;
  41.  
  42. default:
  43.  
  44. break;
  45. }
  46. _getch();
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement