Std::Cin不工作并说它是一个不正确的操作符

#include <iostream>
using namespace std;
int main()
{
    int Principal = 0;
    int RetirementAge = 65;
    int CurrentAge = 0;
    std::cout << "What is your current age?" << std::endl;
    std::cin >> CurrentAge >> std::endl;
    std::cout << CurrentAge << "Is this correct?" << std::endl;
    return 0;
}

它给出了“operator>>”不匹配的错误。如果有帮助,我将在代码块上使用代码块 c++ 11。

回答

问题是这部分: >> std::endl

std::endl仅用于输出流,读入时不要使用它CurrentAge

std::cin >> CurrentAge;


以上是Std::Cin不工作并说它是一个不正确的操作符的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>