0
我想學習C++未聲明的,所以我寫了一個短program.this是我的C++代碼:'CBEGIN' 在此範圍
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main()
{
string line;
regex email(R"(\[email protected](\w+\.)+\w+)");
while (getline(cin, line)) {
smatch matches;
auto current = cbegin(line);
auto last = cend(line);
while (current != last)
{
if (regex_search(current, last, matches, email))
{
ssub_match match = matches[0];
current = match.second;
cout << match.str() << endl;
}
else
{
break;
}
}
}
return 0;
}
我得到這個錯誤:
=== Build file: "no target" in "no project" (compiler: unknown) ===
C:\Users\Public\Documents\CPP Scripts\usingStringType.cpp||In function 'int main()':
C:\Users\Public\Documents\CPP Scripts\usingStringType.cpp|13|error: 'cbegin' was not declared in this scope
C:\Users\Public\Documents\CPP Scripts\usingStringType.cpp|14|error: 'cend' was not declared in this scope
=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===
什麼編譯器?你怎麼稱呼編譯器? –