Seventh Day Learning Content array

Source: Internet
Author: User
Tags set time

Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;

Namespace Day07
{
Class Program
{
static void Main (string[] args)

//  Alarm Alerts
           /*         datetime dt = new DateTime ();
                      dt = DateTime.Now;
                      string t= "2015/03/04 18:30";  //Definition alarm sounded time
                      DateTime a= Convert.todatetime (t);//and Convert to datetime format
                      while (true)
                      {

if (dt >= a)//Enter judgment when time is now greater than or equal to set time
{
Console.WriteLine ("Watch the news broadcast");
Console.WriteLine ("Whether to turn off the alarm y/n");
string x = Console.ReadLine (); Define a variable to accept the value of the input
if (x = = "n")
{

A = A.addminutes (5); When you enter n time +5, five minutes to remind
}
Else
{
Break Jump out of Loop when Y is entered
}
}
else//Current time is less than set time output time and +1
{
Console.WriteLine ("The Time is now" + DT);
DT = dt. AddMinutes (1);
}

}

One-dimensional arrays
while (true)
{
String[] weekdays = new string[] {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
int day = Convert.ToInt32 (Console.ReadLine ());
if (day<=weekdays. Length)
{
Console.WriteLine (Weekdays[day-1]);
}
Else
{
Console.WriteLine ("Incorrect input");
}
}

Two-dimensional array printing "Tian" word
string[,] arr = new string[5, 5];
for (int i = 0; i < 5; i++)//control line
{
for (int j = 0; J < 5; J + +)//Control column
{
if (i==0| | i==4| | j==2| | j==0| | j==4| | i==2)//print at specified location
{
Arr[i, J] = "";
}
Else
{
Arr[i, J] = "";
}
}

}

for (int i = 0; I <5; i++)//print array
{
for (int j = 0; J <5; J + +)
{
Console.Write (Arr[i,j]);

}
Console.Write ("\ n");
}

Console.readkey ();


Enter 10 students ' scores, remove two highest points and two minimum points, and ask for an average score
int[] CJ = new INT[10];
for (int i = 1; i <=; i++)
{
Console.WriteLine ("Please enter the" + i + "bit of the classmate's score:");
Cj[i-1] = Convert.ToInt32 (Console.ReadLine ()); Enter scores and assign values to the array
}
for (int k = 0; k <10; k++)//bubble sort sort by large to small
{
for (int j = k+1; J <, J + +)
{

if (Cj[k] <= cj[j])
{
int A;
A = Cj[k];
CJ[K] = Cj[j];
CJ[J] = A;

}

}
}
for (int i = 0; i <; i++)
{
Console.WriteLine (Cj[i]); Print sorted array
}
Double avr,sum=0;
for (int i = 2; I <8; i++)
{
Sum + = Cj[i]; To remove the scores from the two highest and two minimum points

}
AVR = SUM/6; Calculate the average score
Console.WriteLine (AVR);
Console.readkey (); */

Seventh Day Learning Content array

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.