Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

how do i display the numbers

$
0
0
Hi, I want to create a program where 5 people enter there name, and the computer randomly picks a name and says they have won. I have tried it with a for loop, but I have never been good with for loops. I don not want an integer to appear, I want their input! This is my code:

string[] name = new string[4];

            Console.WriteLine("Please enter name 1");
            name[0] = Console.ReadLine();

            Console.WriteLine("Please enter name 2");

            name[1] = Console.ReadLine();

            Console.WriteLine("Please enter name 3");

            name[2] = Console.ReadLine();

            Console.WriteLine("Please enter name 4");

            name[3] = Console.ReadLine();

            Console.WriteLine("Please enter name 5");

            name[4] = Console.ReadLine();



            for (int i = 0; i < []name; i++) ;

            {
                Console.WriteLine("Well done" + name[i] + " , you are the winner");

            }
            Console.ReadLine();



Any improvements to the for loop to make it display the above wishes?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>