China Naming Network - Ziwei knowledge - 1 to 100 lottery code

1 to 100 lottery code

/*

* Baidu knows that it is getting more and more water. Such a simple question is an answer.

* Never seen a limited number of header files. . And at least limited to. . . .

*/

# include & ltstdio.h & gt

# include & lttime.h & gt

# include & ltstdlib.h & gt

# include & ltstring.h & gt

int? getrand()

{

srand(? (unsigned) time (empty));

Return? rand()% 100+ 1;

}

int? Master ()

{

int? Me;

int? j? =? 0;

int? k? =? 0;

Printf ("Please enter the number you guessed:");

What time? ( 1)

{

scanf("%d ",& ampj);

What if? (j? & gt? 100? ||? j? & lt? 0)

{

Printf ("illegal input");

Return? - 1;

}

Me? =? getrand();

What if? (j? ! =? I)

k? ++;

Printf ("The random number is %d, your guess is %d, and you have guessed %d times \n", i, j, k);

What if? (j? ==? I)

Break;

}

Printf ("Congratulations, you guessed it %d times \n", k+1);

}