first, why put the bulk of a program this short within a function, and not within main(). this makes it much harder to read.
second, after i got the code to work you forgot to add one to the value of the counter in order to limit, so each guess is the 1st, you did count++, which adds 1 after the function, if you use ++count than it actually will add +1 each occurrence .
third, there is no need for the time(0) in the (srand(time(0)) % 1000), (rand() % 1000) works just fine.
forth, you defined
1 2 3 4 5 6
|
while(again == 'y')
{
int count = 1, choice1;
while(count < 11)
{
int correctnum;
|
defining numbers within a while statement is also extremely hard to read, try defining all your variables at the beginning of every function its not like you cannot go back and insert the code for that and it makes the code SO much more readable, especially if you are sharing it at this website or publicly in general.
- that will fix the general issues although you should work on your while loop nesting because at the moment it will go on infinitely forever unless the user wins the game, and the random number will change EACH time you enter a number, making it EXTREMELY inconsistent.
- i also do not just want to hand the working code to you and have you not learn anything.