如果您喜欢C++编程中的那种方式,我会尝试使用,std::因为有人告诉我这是一个好习惯,而不是using namespace std;因为它污染了全局命名空间,所以我是新手或菜鸟.我不确定为什么std::cin >> name;从下面的代码中产生错误,no operator '>>' matches these operands下面是完整的源代码.
#include "stdafx.h"
#include <ios>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
int x, y;
std::string name;
std::cin >> name;
std::cin >> x;
return 0;
}
Run Code Online (Sandbox Code Playgroud)