📄 1.6.txt
字号:
Listing 1.6 Creating Multiple if Statements to Control Several Actions
using System;
namespace _13_IfStatement
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
string input;
Console.Write( “Enter your name: “ );
input = Console.ReadLine();
if( input.ToLower() == “jordan” )
{
Console.WriteLine( “{0}, have you cleaned “ +
“your room yet?”, input );
}
else if( (input.ToLower() == “jake”) ||
(input.ToLower() == “jonah”) )
{
Console.WriteLine( “{0}, clean your room!”, input );
}
else if( input.ToLower() == “mallorie” )
{
Console.WriteLine( “{0}, you may do anything you “ +
“want.”, input );
}
else
{
Console.WriteLine( “Sorry {0}, I don’t know you”,
input );
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -