C # classes; one-dimensional arrays; two-dimensional arrays

Source: Internet
Author: User
Tags email account

1. Enter your email account to determine if the format is correct
(1) There is only one @ Contains IndexOf ==lastindexof
(2) cannot start with @ StartsWith
(3) At least one at the end of the @. Contains
(4) @ and. Can't lean together Contains
(5) cannot end with. EndsWith

Console.Write ("Please enter your email account:");
string a = Console.ReadLine ();
int b = A.indexof ("@");//Determine the index of the first occurrence @
int c = a.lastindexof ("@");//Determine the index of last occurrence @
bool D = a.startswith ("@");//A string that determines whether it starts with @
string e = a.substring (b);//intercept the string following the start of index b
bool F = a.contains ("@."); /judgment is not a string containing @.
bool g = E.contains ("."); /judgment is not a string containing.
bool H = E.endswith ("."); /Judging is not a string with a. End
if (b = = c)
{
if (d = = False)
{
if (g = = True)
{
if (f = = false)
{
if (h = = False)
{
Console.WriteLine ("Input correct");
}
Else
Console.WriteLine ("Input Error");
}
Else
Console.WriteLine ("Input Error");
}
Else
Console.WriteLine ("Input Error");
}
Else
Console.WriteLine ("Input Error");
}
Else
Console.WriteLine ("Input Error");
console.readline ();

2. Enter the time of the start of the relationship, counting the total number of days until today
(1) Totaldays time difference specific to which day
(2) DayOfYear

* One-dimensional array

3. Enter the number of classes, put all ages into the array,

Print out the age of a third person

4. Enter the number of classes and enter each person's score into the array
Calculate the average score

* Bubble Sort

5. Arrange a group of numbers from large to small

* * Two-dimensional array

6. Print an array

{2,3,4},
{5,6,7},
{8,9,1},
{3,5,7},

7. Print out the word "King"

8. Enter the number of people,
According to the number of people to enter the language of each person's scores.

Console.Write ("Please enter the number of people:");
int a = Int. Parse (Console.ReadLine ());

double[,] fen = new double[a, 3];
for (int i = 0; i < A; i++)
{
For (int j = 0; J < 3; j + +)
{
if (j = = 0)
{
Console.Write ("Please enter" + (i + 1) + "Personal language score:");
}
else if (j = = 1)
{
Console.Write ("Please enter" + (i + 1) + "Personal math score:");
}
Else
{
Console.Write ("Please enter" + (i + 1) + "personal English Score:");
}
fen[i, j] = Double. Parse (Console.ReadLine ());
}
}
Console.WriteLine ("Print below, press ENTER!") ");
console.readline ();
//Print
for (int i = 0; i < A; i++)
{
For (int j = 0; J < 3; j + +)
{
if (j = = 0)
{
Console.Write ("No." + (i + 1) + "Personal language score:");
}
else if (j = = 1)
{
Console.Write ("No." + (i + 1) + "Personal math score:");
}
Else
{
Console.Write ("No." + (i + 1) + "personal English Score:");
}
Console.WriteLine (Fen[i, J]);
}
}
console.readline ();

C # classes; one-dimensional arrays; two-dimensional arrays

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.