C # basic Sixth lecture

Source: Internet
Author: User
Tags ticket

Boil boiling water

First ask: "Whether to boil boiled water (y/n)"

Yes, the execution--0°--100° (30°---water temperature, 50°---hot, 80°---the water is going to open, 100°---Water has been opened,
End. )

Judging Loop selection Jump

Alarm Clock Service
Define when to remind (2015-03-04 18:30) Watch the news broadcast .....

Gets the current time, the time is incremented in minutes, until the alarm is turned off when the alarm is determined to be equal to the time it was defined, no, the definition time is increased by five minutes after the reminder.

Using System;
Using System.Collections.Generic;
Using System.Diagnostics;
Using System.Text;


Namespace MYTest
{
Class Program
{
static void Main (string[] args)
{
/* Console.WriteLine ("Please Enter Judgment year:");
int x = Convert.ToInt32 (Console.ReadLine ());

if (x%400==0| | (x% 4 = = 0&&x%100!=0))
{

Console.WriteLine (x+ "is a leap year!) ");
}
Else
{
Console.WriteLine (x + "is not a leap year!) ");
}

*/


/*
Console.WriteLine ("Please enter three number automatically determine the size:");
int A, B, C, JG;
A = Convert.ToInt32 (Console.ReadLine ());
b = Convert.ToInt32 (Console.ReadLine ());
c = Convert.ToInt32 (Console.ReadLine ());
if (a>b&&a>c)
{
JG = A;
}
else if (b>a&&b>c)
{
JG = b;
}
Else
{
JG = C;
}
Console.WriteLine ("Maximum number is" + JG); */

/*
Console.WriteLine ("Please enter a number within 24:");
int A;
string zh;
A = Convert.ToInt32 (Console.ReadLine ());
if (a>12)
{
if (a==24)
{
ZH = ("00AM");
}
Else
{
ZH = (a-12) + "PM";
}

}
Else
{
ZH = a + "AM";
}
Console.WriteLine (en);
*/

Console.WriteLine ("Let's Get Married");
String A, B, c, JG = "no words ...." ";
Console.WriteLine ("The Goddess asked:" Is there a house? ”");
A = Console.ReadLine ();
if (A = = "have")//If there is a house, I'll ask the next question.
//{
Console.WriteLine ("The Goddess asked:" Is there a car? ”");
b = Console.ReadLine ();
if (b = = "yes")//If there is a car, I'll ask the next question.
// {
Console.WriteLine ("The Goddess asked:" Is there a ticket? ”");
c = Console.ReadLine ();
if (c = = "have")//If there is a ticket .....
// {
JG = "Let's Get Married";
// }
else//no ticket how to answer
// {
JG = "Seize the Money";
// }
// }
else//No car goddess how to answer
// {
JG = "Grab the car and say it again." ";
// }
//}
else//No house goddess how to answer
//{
JG = "Even the house is not there, I will not go down to ask." ";
//}

Console.WriteLine (JG);
Console.readkey ();


Console.WriteLine ("Let's Get Married");
String A, B, C, jg= "no words ...." ";
Console.WriteLine ("The Goddess asked:" Is there a house? ”");
A = Console.ReadLine ();


Switch (a)
//{
Case "has":
Console.WriteLine ("The Goddess asked:" Is there a car? ”");
b = Console.ReadLine ();
Switch (b)
// {
Case "has":
Console.WriteLine ("The Goddess asked:" Is there a ticket? ”");
c = Console.ReadLine ();
Switch (c)
// {
Case "has":
JG = "Let's Get Married";
Break
Case "None":
JG = "Seize the Money";
Break
Default
Break
// }
Break
Case "None":
JG = "Wait till you have the car";
Break
Default
Break
// }
Break
Case "None":

JG = "There is no house, nothing else I will ask ...." See for yourself ... ";
Break
Default
Break
//}
Console.WriteLine (JG);
Console.readkey ();


//int A;
//string x= "";
//console.writeline ("Please select words within 0-12");
//a=convert.toint32 (console.readline ());
//switch (a)
//{
//Case 0:
//x = "0 selected",
//Break,
//Case 1:
//x = "1 selected";
//Break ;
//Case 2:
//x = "2 selected",
//Break,
//Case 3:
//x = "3 selected",
//Break,
//Case 4:
//X = "4 selected";
//break;
//Case 5:
//x = "5 selected",
//Break,
//Case 6:
//x = "6 selected",
//Break,
//Case 7:
//X = "7 selected";
//break;
//Case 8:
//x = "8 selected",
//Break,
//Case 9:
//x = "9 selected";
//break;
//Case:
// x = "10 selected";
//break;
//Case:
//x = "Select one";
//break;
//Case:
//x = "Selected is";
//break;

//default:
//x = "Default selected";
//break;
//}
//console.writeline (x);
//console.readkey ();

Random r = new Random ();
string x, Y;
int A=r.next (0,3);
int B=r.next (0,3);

Switch (a)
//{
Case 0://Scissors
x = "Scissors";
Break
Case 1://Stone
x = "Stone";
Break
Case 2://Cloth
x = "cloth";
Break
Default
x = "shamelessly";
Break
//}
Switch (b)
//{
Case 0://Scissors
y = "scissors";
Break
Case 1://Stone
y = "stone";
Break
Case 2://Cloth
y = "cloth";
Break
Default
y = "shamelessly";
Break
//}

Console.WriteLine ("X Out is" +x);
Console.WriteLine ("Y out is" + y);
string JG = "";
if (a==b)
//{
JG = "Draw";
//}
else if (a>b)
//{
if (a==2&&b==0)
// {
JG = "Y victory";
// }
Else
// {
JG = "x Victory!" ";
// }

//}
else if (b>a)
//{
if ((b==2&&a==0))
// {
JG = "x Victory!" ";
// }
Else
// {
JG = "Y win!" ";
// }

//}
if (a==b)
//{
JG = "Draw";
//}
else if (a>b| | (b==2&&a==0))
//{
JG = "a victory";
//}
else if (b>a| | (a==2&&b==0))
//{
JG = "B victory";
//}


DateTime D=datetime.now;

while (true)
//{
if (d.toshorttimestring () = = "12:00")
// {
Console.WriteLine (d+ "The class is Over");
// }
Else
// {
Console.WriteLine (d);
// }

D = d.addminutes (1);
if (d.toshorttimestring () = = "13:00")
// {
Break
// }
//}


while (true)
//{
DateTime m = DateTime.Now;
Console.WriteLine (m);
TimeSpan time = new TimeSpan (1,1,0,0);

M= M.add (time);
Console.WriteLine (M.addhours (3));
Console.WriteLine (M.addmonths (1));
Console.WriteLine (M.addyears (1));
Console.WriteLine (m.date);
Console.WriteLine (M.dayofweek);
Console.WriteLine (M.hour);
Console.WriteLine (M.month);
Console.WriteLine (M.timeofday);
Console.WriteLine (M.year);
Console.WriteLine (M.toshortdatestring ());

Console.WriteLine (M.dayofyear.tostring ());

Console.WriteLine (m);
Console.Write ("Whether to exit (y/n)");

if (Console.ReadLine (). ToUpper () = = "Y")
// {
Break
// }


//}

while (true)
//{
Console.Write ("Please enter a year");
string D1 = Console.ReadLine ();
Try
// {
DateTime dt = new DateTime ();
DT = DateTime.Parse (d1+ "/2/29");
Console.WriteLine ("Leap Year");
// }
catch (Exception)
// {
Console.WriteLine ("Not a leap year");

// }

Console.Write ("Whether to exit (y/n)");

if (Console.ReadLine (). ToUpper () = = "Y")
// {
Break
// }
//}

int y=9;

for (int i = 1; I <=5; i++)
{
Console.WriteLine ("+i+", "the second Cycle");
for (int j = 1; J <= 5; j + +)
{
if ((i = = 3 | | j = 3) | | (i==1) | | (i==5) | | (j==1) | | (j==5))
{
Console.Write ("0");
}
Else
{
Console.Write ("");
}
}
Console.WriteLine ();

}

Console.WriteLine ("HelloWorld" is taken out of each word, output uppercase.) ");
String str = "HelloWorld";
for (int i = 0; i < str. Length; i++)
{
Console.Write (str. Substring (i, 1). ToUpper () + "\ T");
}


Console.ReadLine ();



}

}
}

C # basic Sixth lecture

Related Article

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.