harish reddy

harish reddy

  • 1.8k
  • 162
  • 15.9k

Random class excercise

Mar 18 2018 10:52 PM
I am trying to print phrase and stories randomly. but i am getting the full as it is...everytime i complie i should get a random message whcih i am not getting. pls help. also knindly give me some links where i can practice classes and objects with constrcutors.
Random rnd = new Random();
string[] phrase = new string[] { "The product is excellent., This is a great product., I use this product constantly., This is the best product from this category." };
string[] stories = new string[] { "Now I feel better.", "I managed to change.", "It made some miracle.", "I can’t believe it, but now I am feeling great.", "You should try it, too. I am very satisfied." };
Console.WriteLine("{0}", phrase[rnd.Next(4)]);
Console.WriteLine("{0}", stories[rnd.Next(5)]);

Brought to you by:

Answers (4)