回分類題庫
d224: 101OOP Lab Exercise: Student Class (Advanced)
出處:

Difficulity : N/A
Accepted : 47 Times | Submit :287 Times | Clicks : 1556
Accepted : 44 Users | Submit : 45 Users | Accepted rate : 98%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2012-10-15 14:41

Content :

The Student Class records a student name, a studentID, a Email, a PhoneNumber.

Your task is to write:  Main.cc, Student.h, Student.cc in C++.

 

Student.h /Student.cc are the definition and implementation of class Student. Please concetrate on Object Oriented Concepts such as Encapsulation.

 

Main.cc is the implementation of handling input, output ...etc.

Adding some functions is always a good idea.

(ex. Sort function, Print function, Replace function…etc.)

Input :

There are several sets of test data.

For each set of data:

 The first line is an integer N indicates the number of the Student.

 The following N lines, each line is a record of a student.

 Each record of student is consist of four inputs separated by space.

 The syntax is : Name, ID, Email, Phone

 

 Then, Read instructions to print or modify the data.

 There are five instructions as following:

  Print

  Sort

  Find [ID]

  Replace [ID] [Syntax (WhichData)] [Data]

  Quit

When inputting “Quit”, start the next set of test data.

Output :

Please refer to sample output.

Print”There is not the corresponding data.” when Find [ID] or Replace [ID] [Syntax (WhichData)] [Data] failed.

(Print fifty ‘=’ after outputting the result of an instruction )

Sample Input :

1
Toyz 1010101 1010101@nccu.edu.tw 0900-000000
Print
Quit
3
Orange 101753005 101753005@nccu.edu.tw 09xx-xxxxxx
Iris 101753001 101753001@nccu.edu.tw 09xx-xxxxxx
TPA 101753002 101753002@nccu.edu.tw 09xx-xxxxxx
Print
Sort
Find 101753005
Find 101753003
Replace 101753002 ID 521337
Sort
Quit

Sample Output :

Name: Toyz
ID: 1010101
Email: 1010101@nccu.edu.tw
Phone: 0900-000000
==================================================
Name: Orange
ID: 101753005
Email: 101753005@nccu.edu.tw
Phone: 09xx-xxxxxx
Name: Iris
ID: 101753001
Email: 101753001@nccu.edu.tw
Phone: 09xx-xxxxxx
Name: TPA
ID: 101753002
Email: 101753002@nccu.edu.tw
Phone: 09xx-xxxxxx
==================================================
Name: Iris
ID: 101753001
Email: 101753001@nccu.edu.tw
Phone: 09xx-xxxxxx
Name: TPA
ID: 101753002
Email: 101753002@nccu.edu.tw
Phone: 09xx-xxxxxx
Name: Orange
ID: 101753005
Email: 101753005@nccu.edu.tw
Phone: 09xx-xxxxxx
==================================================
Name: Orange
ID: 101753005
Email: 101753005@nccu.edu.tw
Phone: 09xx-xxxxxx
==================================================
There is not the corresponding data.
==================================================
Name: TPA
ID: 521337
Email: 101753002@nccu.edu.tw
Phone: 09xx-xxxxxx
==================================================
Name: TPA
ID: 521337
Email: 101753002@nccu.edu.tw
Phone: 09xx-xxxxxx
Name: Iris
ID: 101753001
Email: 101753001@nccu.edu.tw
Phone: 09xx-xxxxxx
Name: Orange
ID: 101753005
Email: 101753005@nccu.edu.tw
Phone: 09xx-xxxxxx
==================================================

Hint :


  

Author :

(管理員:oop10101)

  Solve it!   Status Forum (0)

C++
C
JAVA
41681. oop100703013 (6 ms , 452KB)
41639. oop100703048 (6 ms , 416KB)
41332. oop99303052 (6 ms , 452KB)
42049. oop100703052 (8 ms , 430KB)
41792. oop98301040 (8 ms , 436KB)
沒有解題記錄 57743. nwgs524513cja (80 ms , 196KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡