An example Analysis of operator priority of C #
This article mainly introduces the relevant knowledge of operator priority instance analysis of C#, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on operator priority instance analysis of C#. Let's take a look.
Example
Using System
Namespace OperatorsAppl
{
Class Program
{
Static void Main (string [] args)
{
Int a = 20
Int b = 10
Int c = 15
Int d = 5
Int e
E = (a + b) * c / d; / / (30 * 15) / 5
Console.WriteLine ("(a + b) * c / d is {0}", e)
E = (a + b) * c) / d; / / (30 * 15) / 5
Console.WriteLine (the value of "(a + b) * c) / d is {0}", e)
E = (a + b) * (c / d); / / (30) * (15tick)
Console.WriteLine (value of "(a + b) * (c / d) is {0}", e)
E = a + (b * c) / d; / / 20 + (150max 5)
Console.WriteLine (the value of "a + (b * c) / d is {0}", e)
Console.ReadLine ()
}
}
}
When the above code is compiled and executed, it produces the following results:
(a + b) * c / d value is 90 ((a + b) * c) / d value is 90 (a + b) * (c / d) value is 90a + (b * c) / d value is 50 about "operator priority example analysis of C#" this article is introduced here, thank you for reading! I believe you all have a certain understanding of the knowledge of "operator priority case analysis of C#". If you want to learn more, you are welcome to follow the industry information channel.