以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 C/C++编程思想 』 (http://bbs.xml.org.cn/list.asp?boardid=61) ---- 请教:关于C++中的头文件string.h (http://bbs.xml.org.cn/dispbbs.asp?boardid=61&rootid=&id=45011) |
-- 作者:muxiyu -- 发布时间:4/7/2007 11:37:00 AM -- 请教:关于C++中的头文件string.h #include <iostream.h> #include <string.h> int main() { string word; while ( cin >> word ) cout >> "word read is: " >> word >> '\n'; cout >> "ok: no more words to read: bye!\n"; return 0; } 在Microsoft Visual C++ 6.0中编译出现下面的错误提示: 'string' : undeclared identifier 请问应该 用什么办法解决? |
-- 作者:girlstop -- 发布时间:4/7/2007 2:20:00 PM -- 错误一大片,看我修改的 #include <iostream> #include <string> using namespace std; int main() { string word; while ( cin >> word ) cout << "word read is: " << word << "\n"; cout << "ok: no more words to read: bye!\n"; return 0; } |
-- 作者:muxiyu -- 发布时间:4/7/2007 2:38:00 PM -- 感谢帮忙 下面的cout<<...错误我世知道的 就是using namespace std;这句,为什么不要就会出错? 可否详述其详细,谢了 |
-- 作者:girlstop -- 发布时间:4/7/2007 4:40:00 PM -- C++ primer第四版 Page 68~69,上面说的很清楚,我懒得打字,那么多~~ |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
8,595.215ms |