level 11
0皇家咖啡0
楼主
从书上抄的代码报错…
解决不能只好伸手
源码:
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::string;
int main()
{
string text;
cin >> text;
for (auto a = text.begin();
!a->empty() && a != text.cend; ++a)
cout << toupper(*a);
return 0;
}
报错:
/data/data/com.n0n3m4.droidc/files/temp.c: In function 'int main()':
/data/data/com.n0n3m4.droidc/files/temp.c:11:8: error: request for member 'empty' in '* a.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-><char*, std::basic_string<char> >()', which is of non-class type 'char'
!a->empty() && a != text.cend; ++a)
^
compilation terminated due to -Wfatal-errors.
看起来好像是说char没有empty成员,
但是光明正大的写在书上…
2014年01月10日 01点01分
1
解决不能只好伸手
源码:
#include<iostream>
#include<string>
using std::cin;
using std::cout;
using std::string;
int main()
{
string text;
cin >> text;
for (auto a = text.begin();
!a->empty() && a != text.cend; ++a)
cout << toupper(*a);
return 0;
}
报错:
/data/data/com.n0n3m4.droidc/files/temp.c: In function 'int main()':
/data/data/com.n0n3m4.droidc/files/temp.c:11:8: error: request for member 'empty' in '* a.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-><char*, std::basic_string<char> >()', which is of non-class type 'char'
!a->empty() && a != text.cend; ++a)
^
compilation terminated due to -Wfatal-errors.
看起来好像是说char没有empty成员,
但是光明正大的写在书上…