Kodewick
学びはじめる →
入門←→0 / 60

大声で言おう

#002入門toupper(ch)約 3 分

shout(s) を書きましょう。s の文字をすべて大文字にして、最後に ! をつけます。文字でないものはそのままです。

例
shout("hi")→'HI!'
shout("")→'!'
関数string shout(string s)
main.cpp
#include <string>
#include <cctype>
using namespace std;

string shout(string s) {
    for (char &ch : s) {
        // ここにコードを書く:ch を大文字にする
    }
    return s + "!";
}
Ctrl + Enter でも実行できます
結果

実行すると例で試せます。よさそうなら提出しましょう。