1.6.txt
来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 41 行
TXT
41 行
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 + =
减小字号Ctrl + -
显示快捷键?