Answer the question
In order to leave comments, you need to log in
How to solve problems in source code?
Greetings!
I would like to ask:
1) Why is only one result displayed? (Hello Jo only)
using System;
class A
{
static void WriteHelloJo()
{
Console.WriteLine("Hello Jo");
Console.ReadLine();
}
static void WriteHelloSam()
{
Console.WriteLine("Hello Sam");
Console.ReadLine();
}
static void WriteHelloYou()
{
Console.WriteLine("Hello You");
Console.ReadLine();
}
static void Main()
{
WriteHelloJo();
WriteHelloSam();
WriteHelloYou();
}
}
using System;
class A
{
void WriteHello(string someName)
{
Console.WriteLine("Hello " + someName);
}
static void Main
{
WriteHello("Jo");
WriteHello("Sam");
WriteHello("You");
}
}
Answer the question
In order to leave comments, you need to log in
1. Try [Enter] to press after the output of the first line.
2. No parentheses (UPD: parentheses) after the Main declaration.
2)
using System;
class A
{
static void WriteHello(string someName)
{
Console.WriteLine("Hello " + someName);
}
static void Main()
{
WriteHello("Jo");
WriteHello("Sam");
WriteHello("You");
Console.ReadLine();
}
}
using System;
class A
{
static void WriteHelloJo()
{
Console.WriteLine("Hello Jo");
}
static void WriteHelloSam()
{
Console.WriteLine("Hello Sam");
}
static void WriteHelloYou()
{
Console.WriteLine("Hello You");
}
static void Main()
{
WriteHelloJo();
WriteHelloSam();
WriteHelloYou();
Console.ReadLine();
}
}
Read the Bible C# Flenov better, and preferably several times
There it is written in more detail.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question