#include <iostream>
#include <windows.h>
#include <cstdlib>
#include <stdlib.h>
using namespace std;
int main()
{
int x,y,z;
cout<<"welcome to guessing game\nplayer one pick your number: ";
cin>>x;
if (x < 0)(x > 100);
{
cout<<"out of number range";
}
Sleep(2000);
system("cls");
cout<<"ok player 2 pick the guess";
cin>>y;
if (x == y){
cout<<"congrats you got it right";
}
else{
if (x < y){
cout<<"Go lower";}
else {
if (x > y){
cout<<"higher";}}
}
system("pause>nul");
return 0;
}
入力した数値に関係なく、最初のifステートメントが機能するのを確認できず、数値範囲外が自動的に表示されます。また、if (x < 0)(x > 100); のように非常に近い条件を配置することもできます。また、プログラムの最初に戻るようにするにはどうすればよいですか?