how to make a guessing game in c 2b 2b

Solutions on MaxInterview for how to make a guessing game in c 2b 2b by the best coders in the world

showing results for - "how to make a guessing game in c 2b 2b"
Tom
30 Apr 2017
1#include <iostream>
2#include<cmath>
3// not perfect tho
4using namespace std;
5
6int guessgame(int guessnum){
7    int numberguess =0;
8    int limit = 5;
9 switch(guessnum){
10  case 9:
11      cout<< "you win";
12      break;
13  default:
14
15    while(guessnum != 9&& numberguess < limit){
16
17        cout << "too bad please try again: ";
18        cin >> guessnum;
19        numberguess++;
20        }
21}
22 if (numberguess <= limit&& numberguess > 0){
23 cout<< "you still win anyway ";}
24 else if(numberguess = limit && numberguess >0){ cout << "you lose";}
25}
26
27
28
29
30
31
32
similar questions
queries leading to this page
how to make a guessing game in c 2b 2b