#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;
}
Run Code Online (Sandbox Code Playgroud)
它给出了“operator>>”不匹配的错误。如果有帮助,我将在代码块上使用代码块 c++ 11。
问题是这部分: >> std::endl
std::endl仅用于输出流,读入时不要使用它CurrentAge。
std::cin >> CurrentAge;
Run Code Online (Sandbox Code Playgroud)