String Array in Random Quote using C#
Submitted by rinvizle on Thursday, June 30, 2016 - 17:44.
This tutorial, we will create and describes string arrays and it randoms the quotes shows how they work in C# .net. In C# .net, you can use strings as array of characters, However, more common practice is to use the string keyword to declare a string variable. This is the basic implementation for a newbie in programming who plans to build a system in the future.
For creating a random quote, here is the syntax.
Hope its help to all beginners and professional, Learn and enjoy the programming.
Thanks!
Sample Code
String Arrays Sample code- using System;
- public class GenericSample
- {
- public static void Main(string[] args)
- {
- {
- }
- }
- }
- using System;
- public class RandomQuotes
- {
- static void CreateQuotes(List<string> quotes)
- {
- quotes.Add("I Hate Drugs!!!@Weed");
- quotes.Add("Long if its hot, short if its cold...@Popstickle");
- quotes.Add("John 3:16@Verse");
- quotes.Add("Good Bye!!!@Welcome");
- quotes.Add("HAHAHA :P !!!@Bleee");
- }
- static void PrintQuote(string quote)
- {
- Console.WriteLine(substring[0]);
- Console.WriteLine("-" + substring[1]);
- }
- static string GetRandomQuote(List<string> quotes)
- {
- return(quotes[n]);
- }
- public static void Main(string[] args)
- {
- if(args.Length == 0)
- {
- Console.WriteLine("Error Argument:\n * All\n * Random\n * Search");
- return;
- }
- if(args[0] == "random")
- {
- PrintQuote(myRandomQuote);
- }
- else if(args[0] == "all")
- {
- int x = 0;
- {
- x++;
- }
- }
- }
- }

Add new comment
- 227 views