小弟请教下一个string类怎么实现输入啊 有库函数吗?
紧急啊 大哥们
用了楼上的程序怎么报错啊?
--------------------Configuration: yes - Win32 Debug--------------------
Compiling...
yes.cpp
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2065: 'cin' : undeclared identifier
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,class std::basic_string<_E,_Tr,_A> &)' : could not deduce template argument for 'cl
ass std::basic_istream<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,short *)' : could not deduce template argument for 'class std::basic_istream<_E,_Tr
> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,unsigned char &)' : could not deduce template argument for 'class std::basic_istrea
m<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,unsigned char *)' : could not deduce template argument for 'class std::basic_istrea
m<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,signed char &)' : could not deduce template argument for 'class std::basic_istream<
_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,signed char *)' : could not deduce template argument for 'class std::basic_istream<
_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,_E &)' : could not deduce template argument for 'class std::basic_istream<_E,_Tr> &
' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2784: 'class std::basic_istream<_E,_Tr> &__cdecl std::operator >>(class std::basic_istream<_E,_Tr> &,_E *)' : could not deduce template argument for 'class std::basic_istream<_E,_Tr> &
' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(6) : error C2677: binary '>>' : no global operator defined which takes type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable con
version)
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2065: 'cout' : undeclared identifier
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const class std::basic_string<_E,_Tr,_A> &)' : could not deduce template argument f
or 'class std::basic_ostream<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const short *)' : could not deduce template argument for 'class std::basic_ostream<
_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const unsigned char)' : could not deduce template argument for 'class std::basic_os
tream<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const unsigned char *)' : could not deduce template argument for 'class std::basic_
ostream<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const signed char)' : could not deduce template argument for 'class std::basic_ostr
eam<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const signed char *)' : could not deduce template argument for 'class std::basic_os
tream<_E,_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,_E)' : could not deduce template argument for 'class std::basic_ostream<_E,_Tr> &'
from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2784: 'class std::basic_ostream<_E,_Tr> &__cdecl std::operator <<(class std::basic_ostream<_E,_Tr> &,const _E *)' : could not deduce template argument for 'class std::basic_ostream<_E,
_Tr> &' from 'int'
f:\visual c++6.0\vc++\msdev98\myprojects\yes\yes.cpp(7) : error C2677: binary '<<' : no global operator defined which takes type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable con
version)
执行 cl.exe 时出错.
yes.exe - 1 error(s), 0 warning(s)