找到 34423 篇文章 关于编程

C# 中 MathF.IEEERemainder() 方法及示例

AmitDiwan
更新于 2019年11月14日 06:36:09

35 次浏览

C# 中的 MathF.IEEERemainder() 方法用于返回将指定数字除以另一个数字后所得的余数。语法以下是语法:public static float IEEERemainder (float dividend, double float);示例让我们来看一个实现 MathF.IEEERemainder() 方法的示例:using System; public class Demo {    public static void Main(){       float val1 = 90.5f;       float val2 = 13.5f;       float rem = MathF.IEEERemainder(val1, val2);       Console.WriteLine(rem);    } }输出这将产生以下输出:-4示例让我们来看另一个实现 MathF.IEEERemainder() 方法的示例:using ... 阅读更多

C# 中 MathF.Floor() 方法及示例

AmitDiwan
更新于 2019年11月14日 06:32:56

86 次浏览

C# 中的 MathF.Floor() 方法用于查找小于或等于指定浮点值的最大的整数。语法以下是语法:public static float Floor (float val);其中,Val 是浮点值。示例让我们来看一个实现 MathF.Floor() 方法的示例:using System; class Demo {    public static void Main(){       float val = 45.67f;       float res = MathF.Floor(val);       Console.WriteLine("MathF.Floor() = "+res);    } }输出这将产生以下输出:MathF.Floor() = 45示例让我们来看另一个实现 MathF.Floor() 方法的示例:using ... 阅读更多

如何更改 C# 控制台的输出编码方案?

AmitDiwan
更新于 2019年11月14日 06:31:08

269 次浏览

在 C# 中使用 Console.OutputEncoding 属性来更改 C# 中的输出编码方案。示例让我们来看一个示例:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor. Black;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.White;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.OutputEncoding = Encoding.ASCII;       Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding);    } }输出这将产生以下输出:

如何更改 C# 控制台的输入编码方案?

AmitDiwan
更新于 2019年11月14日 06:27:24

124 次浏览

要更改控制台的输入编码方案,请使用 Console.InputEncoding 属性。示例让我们来看一个示例:using System; using System.Collections.Generic; using System.Threading.Tasks; using System.Linq; using System.Text; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.InputEncoding = Encoding.ASCII;       Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding);       Console.CursorTop = 20;       Console.WriteLine("CursorTop = "+Console.CursorTop);    } }输出这将产生以下输出:

C# 中 MathF.Min() 方法及示例

AmitDiwan
更新于 2019年11月14日 06:25:24

52 次浏览

C# 中的 MathF.Min() 方法返回两个指定数字中较小的一个。语法以下是语法:public static float Min (float val1, float val2);其中,val1 是第一个数字,val2 是第二个数字。这两个数字都会被比较。示例让我们来看一个实现 MathF.Min() 方法的示例:using System; public class Demo {    public static void Main(){       float val1 = 6.89f;       float val2 = 4.45f;       Console.WriteLine("Minimum Value = "+MathF.Min(val1, val2));    } }输出这将产生以下输出:Minimum Value = 4.45示例让我们来看另一个... 阅读更多

C# 中 MathF.Max() 方法及示例

AmitDiwan
更新于 2019年11月14日 06:23:54

39 次浏览

C# 中的 MathF.Max() 方法返回两个指定数字中较大的一个。语法以下是语法:public static float Max (float val1, float val2);其中,val1 是第一个数字,val2 是第二个数字。这两个数字都会被比较。示例让我们来看一个实现 MathF.Max() 方法的示例:using System; public class Demo {    public static void Main(){       float val1 = 11.89f;       float val2 = 55.67f;       Console.WriteLine("Maximum Value = "+MathF.Max(val1, val2));    } }输出这将产生以下输出:Maximum Value = 55.67示例让我们来看另一个... 阅读更多

如何在 C# 中更改控制台的 CursorTop?

AmitDiwan
更新于 2019年11月14日 06:21:53

155 次浏览

要在 C# 中更改控制台的 CursorTop,请使用 Console.CursorTop 属性示例让我们来看一个示例:using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);       Console.ForegroundColor = ConsoleColor.Yellow;       Console.WriteLine("Foreground color changed = "+Console.ForegroundColor);       Console.CursorTop = 20;       Console.WriteLine("CursorTop = "+Console.CursorTop);    } }输出这将产生以下输出:

如何在 C# 中更改控制台的 BufferHeight?

AmitDiwan
更新于 2019年11月14日 06:19:06

93 次浏览

要在 C# 中更改控制台的 BufferHeight,请使用 Console.BufferHeight 属性。示例让我们来看一个示例:using System; class Demo {    public static void Main (string[] args) {       Console.BufferHeight = 200;       Console.WriteLine("Buffer Height = "+Console.BufferHeight);    } }输出这将产生以下输出:Buffer Height = 200

如何在 C# 控制台中更改文本的背景颜色

AmitDiwan
更新于 2019年11月14日 06:16:05

2K+ 次浏览

要在控制台中更改文本的背景颜色,请在 C# 中使用 Console.BackgroundColor 属性。示例让我们来看一个示例:using System; class Demo {    public static void Main (string[] args) {       Console.BackgroundColor = ConsoleColor.Blue;       Console.WriteLine("Background color changed = "+Console.BackgroundColor);    } }输出这将产生以下输出:

C# 中 MathF.Exp() 方法及示例

AmitDiwan
更新于 2019年11月14日 06:13:38

63 次浏览

C# 中的 MathF.Exp() 方法返回 e 的指定次幂。语法以下是语法:public static float Exp (float val);其中,Val 是浮点型数字。示例让我们来看一个实现 MathF.Exp() 方法的示例:using System; class Demo {    public static void Main(){       float val = 90f;       float res = MathF.Exp(val);       Console.WriteLine("MathF.Exp() = "+res);    } }输出这将产生以下输出:MathF.Exp() = Infinity示例让我们来看另一个实现 MathF.Exp() 方法的示例:using System; class Demo {    public static void Main(){       ... 阅读更多

广告
© . All rights reserved.