C # compiling platform for student management system

Source: Internet
Author: User
Tags readline
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 M Anager {Student Stu = new Student (); ArrayList list = new ArrayList (); public void Menu () {Console.WriteLine ("1") Add student Information 2. Query student Information 3. Revise student Information 4. Delete Student Information 5. Exit system "); int messager = Int. Parse (Console.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 ("Please enter student number:"); stu.id = Int. Parse (Console.ReadLine ()); Console.WriteLine ("Please enter student name:"); Stu.name = Console.ReadLine (); Console.WriteLine ("Please enter the student's Age:"); stu.age = Int. Parse (Console.ReadLine ()); Console.WriteLine ("Please enter the student's gender:"); Stu.sex = Console.ReadLine (); List. ADD (Stu); Console.WriteLine ("Add success!") "); ConsolE.writeline ("1. Continue to add 2. Return to main Menu"); int sel = Int. Parse (Console.ReadLine ()); Switch (SEL) {case 1:goto A; case 2:console.clear (); Menu (); Break The public void Res (student stu) {Console.WriteLine ("1. Query 2 by study number 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 + "" + St U.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 query:"); 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.