Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void strToUpper(string &line)
- {
- for (int i = 0; i < line.length(); i++)
- if (islower(line[i]))
- toupper(line[i]);
- }
- void strToLower(string &line)
- {
- for (int i = 0; i < line.length(); i++)
- if (isupper(line[i]))
- tolower(line[i]);
- }
- void main()
- {
- int selecter;
- string line;
- cout << "Enter line:";
- getline(cin, line);
- cout << "Select (1-upper, 2-lower)n";
- cin >> selecter;
- if (selecter == 1)
- strToUpper(line);
- else if (selecter == 2)
- strToLower(line);
- else
- {
- cout << "ERROR!";
- return;
- }
- cout << line << "nnnn";
- }
Add Comment
Please, Sign In to add comment