vendredi 6 septembre 2019

Generating a program that guessed your number

I have to make this code that generates a natural number between 0 and 100 .If the number hasn't been guessed it will say " The number was not guessed" If i haven't guessed the number i can press 1 to start again and 0 to close the program. If the number has been guessed it will say " the number has been guessed in x tries"

I've tried this for an hour, please try to stay to the simple text and variables, i am a noobie.

        Random r = new Random();

        int winNum = new Random().Next(0, 10);

        bool win = false;

        do
        {

            Console.WriteLine("Ghiceste un numar intre 0 si 10");

            string s = Console.ReadLine();

            int i = int.Parse(s);

        }while (win == false);




Aucun commentaire:

Enregistrer un commentaire