daily pastebin goal
78%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void strToUpper(string &line)
  2. {
  3. for (int i = 0; i < line.length(); i++)
  4.     if (islower(line[i]))
  5.         toupper(line[i]);
  6. }
  7. void strToLower(string &line)
  8. {
  9. for (int i = 0; i < line.length(); i++)
  10.     if (isupper(line[i]))
  11.         tolower(line[i]);
  12. }
  13. void main()
  14. {
  15. int selecter;
  16. string line;
  17. cout << "Enter line:";
  18. getline(cin, line);
  19. cout << "Select (1-upper, 2-lower)n";
  20. cin >> selecter;
  21. if (selecter == 1)
  22.    strToUpper(line);
  23. else if (selecter == 2)
  24.     strToLower(line);
  25. else
  26. {
  27.     cout << "ERROR!";
  28.     return;
  29. }
  30. cout << line << "nnnn";
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top