Write a console application that applies to arrays, enumerations, casts, and looping statements

Source: Internet
Author: User

Using System;

Using System.Collections.Generic;

Using System.Linq;

Using System.Text;

Namespace CWork0408 {

Class Program {

public enum Student

{

STU1 = 1,

STU2 = 2,

STU3 = 3,

Stu4 = 4,

Stu5 = 5,

Stu6 = 6

}

static void Main (string[] args)

{

String[] Student1=new string[6];

Student1[0] = "Zhang Mengting";

STUDENT1[1] = "Yang Mingzhu";

STUDENT1[2] = "Trichon";

STUDENT1[3] = "fenbing";

STUDENT1[4] = "Mason";

STUDENT1[5] = "mu an Feng";

int[] Student2 = new Int[6];

Student2[0] = Convert.ToInt32 (STUDENT.STU1);

STUDENT2[1] = Convert.ToInt32 (STUDENT.STU2);

STUDENT2[2] = Convert.ToInt32 (STUDENT.STU3);

STUDENT2[3] = Convert.ToInt32 (STUDENT.STU4);

STUDENT2[4] = Convert.ToInt32 (STUDENT.STU5);

STUDENT2[5] = Convert.ToInt32 (STUDENT.STU6);

Console.WriteLine ("All Student Names:");

for (int i = 0; i < Student1. Length; i++)

{

Console.Write (student1[i]+ "\ t");

}

Console.WriteLine ("All Student Numbers:");

for (int j = 0; J < Student2. Length; J + +)

{

Console.Write (Student2[j] + "\ t");

}

Console.WriteLine ("\ n");

while (1 = = 1)

{

Console.Write ("Please enter student number:");

int id = Int. Parse (Console.ReadLine ());

Switch (ID)

{

Case 1:

Console.WriteLine ("Student number 1th" + student1[0);

Break

Case 2:

Console.WriteLine ("Student number 2nd" + student1[1);

Break

Case 3:

Console.WriteLine ("Student number 3rd" + student1[2);

Break

Case 4:

Console.WriteLine ("Student number 4th" + student1[3);

Break

Case 5:

Console.WriteLine ("Student number 5th" + student1[4);

Break

Case 6:

Console.WriteLine ("Student number 6th" + student1[5);

Break

Default

Console.WriteLine ("The student number you entered does not exist!");

Break

}

Console.WriteLine ("\ n");

}

}

}

}

Write a console application that applies to arrays, enumerations, casts, and looping statements

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.