The student management system uses the c # compilation Platform

Source: Internet
Author: User
Tags class manager

Using System; using System. collections. generic; using System. text; using System. collections; namespace StudenManager {struct student {public int id; public string name; public int age; public string sex;} class Manager {student stu = new student (); arrayList list = new ArrayList (); public void Menu () {Console. writeLine ("1. add Student Information 2. querying Student Information 3. modify student information 4. delete Student Information 5. exit System "); int messager = int. parse (Con Sole. readLine (); while (true) {switch (messager) {case 1: addStudent (stu); break; case 2: // Console. clear (); Res (stu); break; case 3: idUpdate (list); break; case 4: del (list); break; case 5: ret (); break;} // break;} public void addStudent (student stu) {a: Console. clear (); Console. writeLine ("Enter the student ID:"); stu. id = int. parse (Console. readLine (); Console. writeLine ("Enter the Student name:"); stu. name = Consol E. readLine (); Console. writeLine ("Enter the student's age:"); stu. age = int. parse (Console. readLine (); Console. writeLine ("Enter the student's Gender:"); stu. sex = Console. readLine (); list. add (stu); Console. writeLine ("added successfully! "); Console. writeLine ("1. continue adding 2. return to the main menu "); int sel = int. parse (Console. readLine (); switch (sel) {case 1: goto a; case 2: Console. clear (); Menu (); break;} public void Res (student stu) {Console. writeLine ("1. query all 2. query by student ID 3. query by name "); int messager = int. parse (Console. readLine (); switch (messager) {case 1: fullRes (list); break; case 2: idRes (list); break; case 3: nameRes (list ); break ;}} public void fullRes (ArrayList list) {foreach (student stu in list) {Console. writeLine (stu. id + "" + stu. name + "" + stu. age + "" + stu. sex);} Console. readLine (); Console. clear (); Menu ();} public void idRes (ArrayList list) {Console. writeLine ("Enter the student ID to query:"); int id = int. parse (Console. readLine (); foreach (student stu in list) {if (id. equals (stu. id) Console. writeLine (stu. id + "" + stu. name + "" + stu. age + "" + stu. sex + "" + list. indexOf (stu);} Console. readLine (); Console. clear (); Menu ();} public void nameRes (ArrayList list) {Console. writeLine ("enter the name of the student to be queried:"); string name = Console. readLine (); foreach (student stu in list) {if (name. equals (stu. name) Console. writeLine (stu. id + "" + stu. name + "& quo

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.