a guessing game to give only 3 output

hello everyone please have been given an assignment to write a code to guess exactly 3 times

Last edited on
What does that even mean? If you require assistance please attempt the assignment and once you get stuck show us what you have and we will point you in the correct direction.
okay
#include <iostream>
using namespace std;


int main()
{
int randNumber = 0, userNumber = 0;
int numOfAttempts = 1;

unsigned seed = time(0);


srand(seed);


randNumber = 1 + rand()%10;


cout << " ";
cin >> userNumber;


while (userWins != true)
{
add this header file at the top #include <ctime>

inside of your main you need to seed the random number generator like this:
1
2
//Seed generator
        srand(time(NULL));


and lastly you get the random number like this :
randomNum = rand() % 100 + 1; //between 1 and 100
much appreciated king kush..
You're welcome. Hope i explained it well enough. If youre still stuck post the code you have and ill take a look and see if i can help further.
Topic archived. No new replies allowed.