string 什么鬼东西?VC++不通过。
下面是我的程序。
#include <iostream>
#include <string>
int main()
{
string strTest;
strTest = "Hello";
cout << "My string is" << strTest << endl;
return 0;
}
VC告诉我 string 和 cout 没定义
我看过<iostream>文件,里面有cout的定义,至于string 定义在<Xstring>里面
不过改回来也没用。
我做错什么了吗?
问题点数:50、回复次数:7Top
1 楼xtra()回复于 2001-08-01 08:46:57 得分 0
你这样写:
#include <iostream.h>
#include <string.h>
试试Top
2 楼111222(www.111222.cn)回复于 2001-08-01 08:49:48 得分 5
stlTop
3 楼zb_china(于是开始苏鲁之的堕落)回复于 2001-08-01 08:51:45 得分 0
你真行Top
4 楼ruixp(锐剑)回复于 2001-08-01 08:52:10 得分 0
#include <iostream>
#include <string>
肯定错了Top
5 楼darkay(火凤凰)回复于 2001-08-01 08:53:40 得分 25
try to add the following line before main
using namespace std;
or you can use a prefix std:: such as std::cout std::string. to indicate you are using the "std" namespace.
read a C++ book for more new C++ grammar.Top
6 楼kane_yj()回复于 2001-08-01 08:55:06 得分 20
using namespace std;---这句加上Top
7 楼ahr(电磁波)回复于 2001-08-01 12:30:46 得分 0
哈哈,加上 using namespace std; ----搞定~!
给分啦!!Top




