guess-number-higher-or-lower 1.0.0
Guess Number Higher or Lower
Loading...
Searching...
No Matches
main.cpp File Reference
#include <bits/stdc++.h>
Include dependency graph for main.cpp:

Go to the source code of this file.

Data Structures

class  Solution
 

Macros

#define N   10
 

Functions

int guess (int num)
 Guess API.
 
int main ()
 

Macro Definition Documentation

◆ N

#define N   10

Definition at line 3 of file main.cpp.

Function Documentation

◆ guess()

int guess ( int  num)

Guess API.

Parameters
numyour guess
Returns
-1 if num is higher than the picked number 1 if num is lower than the picked number otherwise return 0

Definition at line 14 of file main.cpp.

15{
16 // static int random = rand() % N;
17 int random = 6;
18 if (num > random)
19 return -1;
20 else if (num < random)
21 return 1;
22 else
23 return 0;
24}

Referenced by Solution::guessNumber().

◆ main()

int main ( )

Definition at line 52 of file main.cpp.

53{
54 cout << Solution().guessNumber(10) << endl;
55 return 0;
56}
int guessNumber(int n)
Definition main.cpp:29

References Solution::guessNumber().