#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main() {
string str("hello world!");
for (auto &c : str)
c = toupper(c);
cout << str;
return 0;
}
この C++ コードはコンパイルされません。Error msg: main.cpp:21: error: a function-definition is not allowed here before ':' token 質問: C++ に for each ループはありますか (範囲 for ループ?)? 上記の for each ループの何が問題なのですか?
前もって感謝します。