|
|
вернуться в форумCompilation error ? Послано George 25 окт 2011 02:29 while compiler write : ebc95803-3963-4032-87c1-67e160a8f044 ebc95803-3963-4032-87c1-67e160a8f044(9) : error C2039: 'getline' : is not a member of 'std' ebc95803-3963-4032-87c1-67e160a8f044(9) : error C3861: 'getline': identifier not found #include <iostream> using namespace std; int main() { string line; int sum; while ( getline(cin,line) ) { sum=0; for (unsigned int i=0;i<line.length();i++) { if (line[i]!=' ') { sum=sum+(line[i]-1)%3+1; } else { sum++; } } cout<<sum<<"\n"; } } while we can see in example... #include <iostream> ... // numbers int n; while (std::cin >> n) { ... } // lines std::string line; while (std::getline(std::cin, line)) { ... } // characters char c; while (std::cin.get(c)) { ... } or example is wrong ? |
|
|