Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char * toUpperCase(char * stroka) {
- char * new_stroka = new char[1];
- for (int i = 0; stroka[i] != 0; i++) {
- if (stroka[i] >= 97 && stroka[i] <= 122) {
- new_stroka[i] = stroka[i] - 32;
- } else {
- new_stroka[i] = stroka[i];
- }
- }
- return new_stroka;
- }
- char * toLowerCase(char * stroka) {
- char * new_stroka = new char[1];
- for (int i = 0; stroka[i] != 0; i++) {
- if (stroka[i] >= 65 && stroka[i] <= 90) {
- new_stroka[i] = stroka[i] + 32;
- } else {
- new_stroka[i] = stroka[i];
- }
- }
- return new_stroka;
- }
- int main() {
- char * test_strokaoka = "FatCat";
- cout << test_strokaoka << endl;
- cout << toUpperCase(test_strokaoka) << endl;
- cout << toLowerCase(test_strokaoka) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement