#include <stdio.h>
#include <iostream.h>
int main ()
{ string word;
while (cin>>word )
cout<<"word read is: " <<word; cout<<"end";
return 0;
}编译不通过(书上copy)
vc 里有string 吗?如果没有string.h 有什么用?
#include <iostream.h>
int main ()
{ string word;
while (cin>>word )
cout<<"word read is: " <<word; cout<<"end";
return 0;
}编译不通过(书上copy)
vc 里有string 吗?如果没有string.h 有什么用?
#include<string>
#include <iostream>
using namespace std;
int main ()
{
string word;
while (cin>>word )
cout<<"word read is: " <<word;
cout<<"end";
return 0;
}
但using namespace std;不明白
请指教
using namespace std;让他们对你可见,否则你不能调用他们
这样string对你是可见的,cout不可见
标准C++库的头文件是没有扩展名的,如
#include <iostream>
#include <string>如果你用
#include <iostream.h>
那就不用写 using语句了