program.cs
来自「csharp课本的源代码」· CS 代码 · 共 37 行
CS
37 行
using System;
using System.Collections.Generic;
using System.Text;
namespace IfExample
{
class Program
{
static void Main()
{
Console.Write("Please input a number as x:");
string i = Console.ReadLine();
int x = Convert.ToInt32(i);
int y;
if (x > 0)
{
y = 1;
}
else
{
if (x == 0)
{
y = 0;
}
else
{
y = -1;
}
}
Console.WriteLine("The result of y is {0}.", y);
//按回车键结束
Console.ReadLine();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?