how to make a guessing game in c++
#include <iostream>
#include<cmath>
// not perfect tho
using namespace std;
int guessgame(int guessnum){
int numberguess =0;
int limit = 5;
switch(guessnum){
case 9:
cout<< "you win";
break;
default:
while(guessnum != 9&& numberguess < limit){
cout << "too bad please try again: ";
cin >> guessnum;
numberguess++;
}
}
if (numberguess <= limit&& numberguess > 0){
cout<< "you still win anyway ";}
else if(numberguess = limit && numberguess >0){ cout << "you lose";}
}