Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // zad_2
- //
- // Created by Rafał Hrabia on 19/01/2020.
- // Copyright © 2020 Rafał Hrabia. All rights reserved.
- //
- #include <iostream>
- #include <cctype>
- using namespace std;
- char*foo(char*str, int length) {
- for(int i = 0; str[i]; i++) {
- if (isupper(str[i])) str[i] = tolower(str[i]);
- else if ( islower(str[i]) && (i == 0 || isspace(str[i-1]))) str[i] = toupper(str[i]);
- }
- return str;
- }
- int main(int argc, const char * argv[]) {
- char str[50] = "Dark Side of the Moon";
- cout << foo(str, 50) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement