- 论坛徽章:
- 0
|
- #include <iostream.h>;
- #include <string>;
- using namespace std; //haven't explained this yet ...
- int main()
- {
- string user_name;
- cout<<"Please enter your first name:";
- cin>;>;user_name;
- cout<<'\n'
- <<"Hello, "
- <<" ... and goodbye!\n";
- return 0;
- }
复制代码
对于这个原代码,有几个问题
using namespace std是使用名字空间,有什么作用
string 是关键字吗?是不是包含在string头文件中,那为什么没有.h呢?
最后,编译错误
D:\Souce CodeZ\Essential C++\chapter 1\chapter 1.cpp(10) : error C2679: binary '>;>;' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>;,class std::allocator<char>; >;' (or there is
no acceptable conversion) |
|