注册 登录
编程论坛 C++教室

关于string问题

tantan821 发布于 2010-08-03 22:07, 943 次点击
#include <iostream.h>
#include <string>
int main()
{
    string line;
    while (getline(cin,line))
    {
        cout<<line;
    }
    return 0;
}
为什么报错说没有声名  是我编译器的问题吗?
6 回复
#2
tianxiao1102010-08-03 22:30
好像没定义命名空间。加上  using namespace std; 试试
#3
tantan8212010-08-03 22:47
不行啊
#4
shn5212010-08-04 09:30
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string line;
    while (getline(cin,line))
    {
        cout<<line;
    }
    return 0;
}
#5
tantan8212010-08-04 10:18
可以帮我解释下么   为什么加个 .h编译就过不去呢
#6
mxs8102010-08-04 10:45
#include <文件名>
这是个文件名,要是你要包含的文件名后面没有.h后缀,
你加上了的话,系统就找不到所要的文件了~~~
#7
holychild2010-08-24 23:04
#include<文件名>和#include<文件名.h>不可以混用的啊!
1