Advertisement
IvanITD

2 - Mad Libs

Jan 17th, 2024
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.75 KB | Source Code | 0 0
  1. namespace Mad_Libs
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             /*
  8.             This program is about "Mad Libs" game, and we will need to write a code that will help the user pick only the words for his story. The story should be written by us. The user should only input the required text that will fill the written story.
  9.             Author: Ivan Ivanov
  10.             */
  11.  
  12.  
  13.             // Let the user know that the program is starting:
  14.             Console.WriteLine("Dear user! \nWelcome to the game of Mad Libs!");
  15.  
  16.             // Give the Mad Lib a title:
  17.             string title = "WORDIE";
  18.  
  19.             Console.WriteLine(title);
  20.             // Define user input and variables:
  21.  
  22.             // Here we're asking the user to type a name that he desires, for the main character!
  23.             Console.WriteLine("Dear user! \nPlease input a name that we can call you!");
  24.             string mainCharacterName = Console.ReadLine();
  25.  
  26.             // Here we ask the user to type three different adjectives and save them in three different variables. The variables are named differently in order to be used later for the story!
  27.             Console.WriteLine($"Dear user! \nPlease write three different adjectives. Adjectives could be words like: color (red), texture (hard) or a feeling (silly).");
  28.             string adjective1 = Console.ReadLine();
  29.             string adjective2 = Console.ReadLine();
  30.             string adjective3 = Console.ReadLine();
  31.  
  32.             // Here we ask the user to input a verb, in order to be inoputted into the story!
  33.             Console.WriteLine($"Dear user! \nPlease write one verb of your choice. The verb must be something like: sit, sleep or eat. \nChoose your prefered one and input it in the console app!");
  34.             string verb = Console.ReadLine();
  35.  
  36.             // Here we ask the user to input two nouns, in order to be added to our story!
  37.             Console.WriteLine($"Dear user! \nPlease input two different nouns of your choice. It could be a person (girl), a place (cabin), or thing (toaster). \nMake your choices and write them in the console!");
  38.             string noun1 = Console.ReadLine();
  39.             string noun2 = Console.ReadLine();
  40.  
  41.             // At this point we have a little bit of progress. Here we have to ask the user to input one of each of the following: animal, food, fruit, superhero, country, dessert, year.
  42.  
  43.             Console.WriteLine($"Dear user! \nAt this point you have made some inputs already, and now is the most valiable point of the game. \nPlease input one of each of the following: \nAn animal \nA food \nA fruit \nA superhero \nA country \nA dessert \nA year");
  44.             string animal = Console.ReadLine();
  45.             string food = Console.ReadLine();
  46.             string fruit = Console.ReadLine();
  47.             string superhero = Console.ReadLine();
  48.             string country = Console.ReadLine();
  49.             string dessert = Console.ReadLine();
  50.             string year = Console.ReadLine();
  51.  
  52.  
  53.  
  54.             // The template for the story:
  55.  
  56.             /* In this final section we've added every variable, that we took as input from the user, and used it in the story,
  57.              *in a particular way. The order of the variables are as it goes: Name, First adjective, Second adjective, Animal, Food, Verb, First noun, Fruit, Third adjective, Name, Superhero, Name, Country, Name, Dessert, Name, Year, Second Noun.
  58.              */
  59.             string story = $"This morning {mainCharacterName} woke up feeling {adjective1}. 'It is going to be a {adjective2} day!' " +
  60.                 $"Outside, a bunch of {animal}s were protesting to keep {food} in stores. They began to {verb} to the rhythm of the {noun1}, which made all the {fruit}s very {adjective3}. " +
  61.                 $"Concerned, {mainCharacterName} texted {superhero}, who flew {mainCharacterName} to {country} and dropped {mainCharacterName} in a puddle of frozen {dessert}. " +
  62.                 $"{mainCharacterName} woke up in the year {year}, in a world where {noun2}s ruled the world.";
  63.  
  64.  
  65.             // Print the story:
  66.  
  67.             // Finaly we can print the whole story and show it to the user!
  68.             Console.WriteLine(story);
  69.  
  70.             // Thank the user for playing the game and make sure to advice him to try it again!
  71.  
  72.             Console.WriteLine();
  73.             Console.WriteLine();
  74.             Console.WriteLine();
  75.  
  76.             Console.WriteLine("Congratulations user!!! \nYou just finished our game and created a new story! \nIf you liked it, make sure you try it again, but this time with different words and options of your choice! \nEnjoy The Game!");
  77.  
  78.             // THE END!!!
  79.             //________________________________________
  80.         }
  81.     }
  82. }
  83.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement