当我输入两个字母时,为什么显示的是 0 2 而不是 2 2,,为什么给x的初始值2没起作用
#include
int main()
{
std::cout << "you should enter two numbers:" ;
int x{ 2 };
int y{ 2 };
std::cin >> x >> y;
std::cout << "great, now you entered " << x << " and " << y << '\n';
return 0;
}
你设置的是整型变量