Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- string capitals(const string& text);
- int main()
- {
- string input;
- cout << "Enter your text: ";
- getline(cin, input);
- cout << "Output: " << capitals(input) << endl;
- return 0;
- }
- string capitals(const string& text)
- {
- int flag = false;
- string temp = "";
- for (int i = 0; i < text.length(); i++)
- {
- if (text[i] == '[')
- {
- flag = true;
- continue;
- }
- else if (text[i] == ']')
- {
- flag = false;
- continue;
- }
- if (flag)
- {
- temp += toupper(text[i]);
- }
- else
- {
- temp += text[i];
- }
- }
- return temp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement