Switch Case statement

Source: Internet
Author: User
Tags case statement switch case

while (true)
{
Console.Write ("Please enter the Year:");
int y = Int. Parse (Console.ReadLine ());
if (y >= 1 && y <= 9999)
{
if (y% 4 = = 0 && y% = 0 | | y% 400 = 0)
{
Console.WriteLine ("You have entered a leap year! ");
Console.Write ("Please enter the month:");
int m = Int. Parse (Console.ReadLine ());
if (m>=1&&m <= 12)
{
Console.Write ("Please enter Date:");
int d = Int. Parse (Console.ReadLine ());
if ((((M = = 1 | | m = = 3 | | m = = 5 | | m = = 7 | | m = 8 | | m = = | | m = = && (d>=1&&d <= 31)) | | ( (m = = 4 | | m = = 6 | | m = = 9 | | m = = one) && (d>=1&&d <= 30)) | | (M = = 2 && (d>=1&&d <= 29)))
{
Switch (m)
{
Case 1:console.writeline ("is {1} days of {0} years.") ", y,d);
Break
Case 2:console.writeline ("is {1} days of {0} years.") ", Y, + D);
Break
Case 3:console.writeline ("is {1} days of {0} years.") ", Y, + + + D);
Break
Case 4:console.writeline ("is {1} days of {0} years.") ", Y, + + + + D);
Break
Case 5:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + D);
Break
Case 6:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + D);
Break
Case 7:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + D);
Break
Case 8:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + D);
Break
Case 9:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + D);
Break
Case 10:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + + + + D);
Break
Case 11:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + + + + + + D);
Break
Case 12:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + D);
Break
}
Console.WriteLine ("Now {0} year {1} month {2} days!") ", y,m,d);
}
Else
Console.WriteLine ("You are not entering the correct date!") ");
Console.WriteLine ("{0} years is a leap year! ", y);
}
Else
Console.WriteLine ("You are not entering the correct month!") ");
}
Else
{
Console.WriteLine ("You are not entering a leap year! ");
Console.Write ("Please enter the month:");
int m = Int. Parse (Console.ReadLine ());
if (m>=1&&m <= 12)
{
Console.Write ("Please enter Date:");
int d = Int. Parse (Console.ReadLine ());
if ((((M = = 1 | | m = = 3 | | m = = 5 | | m = = 7 | | m = 8 | | m = = | | m = = && (d>=1&&d <= 31)) | | ( (m = = 4 | | m = = 6 | | m = = 9 | | m = = one) && (d>=1&&d <= 30)) | | (M = = 2 && (d>=1&&d <= 28)))
{
Switch (m)
{
Case 1:console.writeline ("is {1} days of {0} years.") ", y, D);
Break
Case 2:console.writeline ("is {1} days of {0} years.") ", Y, + D);
Break
Case 3:console.writeline ("is {1} days of {0} years.") ", Y, + + + D);
Break
Case 4:console.writeline ("is {1} days of {0} years.") ", Y, + + + + D);
Break
Case 5:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + D);
Break
Case 6:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + D);
Break
Case 7:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + D);
Break
Case 8:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + D);
Break
Case 9:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + D);
Break
Case 10:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + + + D);
Break
Case 11:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + + D);
Break
Case 12:console.writeline ("is {1} days of {0} years.") ", Y, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + D);
Break
}
Console.WriteLine ("Now {0} year {1} month {2} days!") ", Y, M, d);
}
Else
Console.WriteLine ("You are not entering the correct date!") ");
Console.WriteLine ("{0} years is not a leap year! ", y);
}
Else
Console.WriteLine ("You are not entering the correct month!") ");
}
}
Else
Console.WriteLine ("You are not entering the correct year!") ");
}
Console.ReadLine ();

Switch Case statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.