Use of Case,switch,break
Console.WriteLine ("1. Hamburg");
Console.WriteLine ("2. French fries");
Console.WriteLine ("3. Chicken nuggets");
Console.WriteLine ("4. Chicken Leg");
Console.WriteLine ("5. Chicken rice flower");
Console.Write ("Please enter the number of selected items");
int a = Int. Parse (Console.ReadLine ());
Switch (a)//in parentheses is the variable name that is judged
{
The value behind case 1://case is to determine that the variables in parentheses are not the same, and that the value is followed by a colon
Console.Write ("You have chosen a hamburger");
Break;//break Jump statement, jump out of the nearest curly brace
Case 2://
Console.Write ("Your choice is French fries");
Break
Case 3:
Console.Write ("You have selected chicken nuggets");
Break
Case 4:
Console.Write ("Your choice is chicken leg");
Break
Case 5:
Console.Write ("Your choice is chicken rice flower");
break;//the last one also needs to jump out of curly braces
}
Console.ReadLine ();
Enter month and date to see if the format is correct and to judge leap years
/*console.write ("Please enter the Year:");
int a = Int. Parse (Console.ReadLine ());
if (a >= 0 && a <= 9999)
{
Console.Write ("Please enter the month:");
int b = Int. Parse (Console.ReadLine ());
if (b > 0 && b <= 12)
{
Console.Write ("Please enter Date:");
int c = Int. Parse (Console.ReadLine ());
if (C > 0 && C <= 31)
{
if (b = = 1 | | b = = 3 | | b = = 5 | | b = = 7 | | b = 8 | | b = | | | b = 12)
{
Console.Write ("The period you entered is" + A + "year" + B + "month" + C + "Day");
}
else if (b = = 4 | | b = = 6 | | b = = 9 | | b = = 11)
{
if (C > 0 && C <= 30)
{
Console.Write ("The date you entered is" + A + "year" + B + "month" + C + "Day");
}
Else
{
Console.Write ("You entered the error");
}
}
ELSE//2 Month
{
if ((a% 4 = = 0 && a%! = 0) | | A% 400 = = 0)
{
if (C > 0 && C <= 29)
{
Console.Write ("The date you entered is" + A + "year" + B + "month" + C + "Day");
}
Else
{
Console.Write ("You entered the error");
}
}
Else
{
if (C > 0 && C <= 28)
{
Console.Write ("The date you entered is" + A + "year" + B + "month" + C + "Day");
}
Else
{
Console.Write ("You entered the error");
}
}
}
}
Else
{
Console.Write ("You entered the error");
}
}
Else
{
Console.Write ("You entered the error");
}
}
Else
{
Console.Write ("You entered the error");
}
Console.ReadLine (); */
Standard Weight: 1
Men's weight = height -100±3
Lady weight = height -110±3
/*console.write ("Please enter Gender:");
string x = Console.ReadLine ();
Console.Write ("Please enter weight kg:");
Double kg = double. Parse (Console.ReadLine ());
Console.Write ("Please enter height cm:");
Double cm = double. Parse (Console.ReadLine ());
if (x = = "Male")
{
Double A = kg-(cm-100);
If (a >=-3 && a <= 3)
{
Console.Write ("Your is the standard weight");
}
else if (a > 3)
{
Console.Write ("You are fast becoming a pig");
}
Else
{
Console.Write ("You Are too TM thin");
}
}
else if (x = = "female")
{
Double b = kg-(cm-110);
if (b >=-3 && b <= 3)
{
Console.Write ("Your is the standard weight");
}
else if (b > 3)
{
Console.Write ("You're too fat");
}
Else
{
Console.Write ("You're too skinny");
}
}
Else
{
Console.Write ("You entered the error");
}
Console.ReadLine (); */
Equation ax2+bx+c=0; two quadratic equation. Seeking root
=B2-4AC; If the <0 equation is not real roots
If >0, the equation has two different real roots X1 x2
If =0, the equation has two identical real roots
/*console.writeline ("ax*x+bx+c=0");
Console.Write ("Please enter a=");
Double A = double. Parse (Console.ReadLine ());
Console.Write ("Please enter b=");
Double b = Double. Parse (Console.ReadLine ());
Console.Write ("Please enter c=");
Double c = Double. Parse (Console.ReadLine ());
Double de = (b * b-4 * a * c);
Double x1,x2;
if (a = = 0)
{
Console.Write ("Not one-yuan two-time equation");
}
Else
{
Console.WriteLine ("is a yuan two times equation");
if (De > 0)
{
Console.WriteLine ("There are two different real roots");
X1 = (-B + math.sqrt (DE))/2 * A;
x2 = (-b-math.sqrt (DE))/2 * A;
Console.Write ("x1= (-b+math.sqrt (DE))/2*a");
}
if (de = = 0)
{
Console.WriteLine ("There are two identical real roots");
X1 = (-B + math.sqrt (DE))/2 * A;
Console.Write (x1 = (-B + math.sqrt (DE))/2 * a);
}
Else
{
Console.Write ("No real Roots");
}
}
Console.ReadLine (); */
C language Base statement