# 13891 - Polymorphic naming convention conversion ###### tags: `class` --- ## Brief See the code below ## Solution 0 ```cpp= #include <iostream> #include <string> #include <sstream> #include "function.h" using namespace std; void CamelCase::convert() { converted = true; stringstream ss; string tmp; ss << name; while (!ss.eof()) { string token; getline(ss, token, '-'); token[0] -= 32; tmp += token; } name = tmp; } void CamelCase::revert() { converted = false; string tmp; for (int i = 0; i < name.length(); i++) { if (name[i] < 'a') { if (i) tmp += '-'; name[i] += 32; } tmp += name[i]; } name = tmp; } // Utin ``` ## Reference
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up