即時嘗試學習c + +,並不能找出這個錯誤的原因,它似乎匹配我的其他cout行不是'牛逼得到任何錯誤C++二進制>>找不到操作符,它需要一個右操作數類型的常量字符錯誤
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int number = 42;
int guess;
bool notguessed = true;
while (notguessed);
cout << "Guess my number";
cin >> "Guess";
if (guess == number)
{
cout << "You got it" << endl;
notguessed = false;
}
if (guess < number)
{
cout << "To low try again" << endl;
}
if (guess > number)
{
cout << "To high try again" << endl;
}
return 0;
}
'而(notguessed);'將阻塞下面一切... – WhatsUp
要更明確的是,不要在'while'語句之後放置';'。 –