智能感知:没有运算符>>匹配这些操作数

时间:2011-05-06 23:27:25

标签: .net c++ visual-studio-2010 visual-c++

我试图弄清楚为什么我一直得到编译器错误

智能感知:没有运营商“>>”匹配这些操作数

使用以下代码。非常感谢任何帮助。谢谢

#include "stdafx.h"
#include <string>
#include <iostream>
using namespace std;

 int main(void)
 {
      int n;//number of resources we will  be dealing with 
      cout <<"What is number of resources to be shared?"<<
      cin >> n;
      return 0;
 }

1 个答案:

答案 0 :(得分:4)

提示:

cout <<"What is number of resources to be shared?"<<
cin >> n;

与:

相同
cout <<"What is number of resources to be shared?"<< cin >> n;

<<或许std::endl;之后应该跟;之后,或者更改为{{1}}。