Answered why my Console.WriteLine are not read when I output run

marsh.flint

Member
Joined
Sep 19, 2020
Messages
12
Programming Experience
Beginner
1602545523678.png
 
Last edited by a moderator:
Please post your code in code tags. A screen shot is very hard to read on a small device.

Also post the text of your assignment requirements. Just like trying to read code from a screenshot, reading text from a screenshot on a small device is really hard.
 
hi Ok!


the text of my assignment requirements.

Mad Libs
In C#, variables and string interpolation allow us to transform a piece of text by swapping out different pieces of information.
In this project, we’ll use C# to write a Mad Libs word game! Mad Libs are short stories with blanks for the player to fill in that represent different parts of speech. The end result is a really hilarious and strange story.
Here’s an example of the “Roses are Red” poem changed into a Mad Lib:

Screenshot_28.jpg
Mad Libs require: A short story with blank spaces (asking for different types of words). Words from the player to fill in those blanks.
For this project, we have provided the story, but it will be up to you to complete the following: Prompt the user for inputs. Print the story with the inputs in the right places.
It’s important to note that for this project, you should test your app periodically — when you hit save, your app will not run! To run your app, enter dotnet run into the terminal.
dotnet

Let’s begin!

Tasks​

0/14 Complete
Mark the tasks as complete by checking them off

MadLibs Set Up​


1.
Begin by completing the multi-line comment that describes this program.
Stuck? Get a hint


2.
Inform the user that the program is running. You need to be constantly thinking from the users’ point of view – they are the ones who run your program. Make sure that your program is easy for others to understand!
Before the string story, print a message to let the user know that Mad Libs has started.
Stuck? Get a hint


3.
Give your story a title. Change the value of the variable title to a title that you like.



My CODE

C#:
using System;

namespace MadLibs
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("The program is starting.");

            // Give the Mad Lib a title:
            string title = "Morning moody";

            Console.WriteLine(title);

            // Define user input and variables:

            // The template for the story:
            string story = "This morning _ woke up feeling _. 'It is going to be a _ day!' Outside, a bunch of _s were protesting to keep _ in stores. They began to _ to the rhythm of the _, which made all the _s very _. Concerned, _ texted _, who flew _ to _ and dropped _ in a puddle of frozen _. _ woke up in the year _, in a world where _s ruled the world.";

            // Print the story:
        }
    }
}

Mod Edit : Image resized. This helps mobile users
 
Last edited by a moderator:
It's not even just about reading text from a screenshot. When it comes to code, we should be able to just copy and paste your code if we want to run it for ourselves, not type it out again by hand.
 
You were specifically asked to post your code in code tags and you ignored that. Now it is just as hard to read, if not harder, for a different reason. Someone who wants to write code should be able to use a text editor. I have edited your post this time. Please do it for us in the future.
 
The following procedure worked for me:
Code:
mkdir MadLibs

cd MadLibs

dotnet new console

code .

# put in the code from post #3 into Program.cs
# IMPORTANT: Save Program.cs

dotnet run

And I got the following results:
Code:
Program.cs(19,20): warning CS0219: The variable 'story' is assigned but its value is never used [C:\z\Test\dotnetCLI\dotnetCLI.csproj]
The program is starting.
Morning moody

As I noted above. Be sure to save your .CS file.
 
What environment are you in? Is this Unix/Linux, WSL or just Windows?
Windows!
The following procedure worked for me:
Code:
mkdir MadLibs

cd MadLibs

dotnet new console

code .

# put in the code from post #3 into Program.cs
# IMPORTANT: Save Program.cs

dotnet run

And I got the following results:
Code:
Program.cs(19,20): warning CS0219: The variable 'story' is assigned but its value is never used [C:\z\Test\dotnetCLI\dotnetCLI.csproj]
The program is starting.
Morning moody

As I noted above. Be sure to save your .CS file.
Thanks!
 
Back
Top Bottom