COMP2113
COMP2113_ENGG1340 Programming technologies and Computer programming II [Section 2BC] [2023]
Loading...
Searching...
No Matches
Courselist Struct Reference
Collaboration diagram for Courselist:

Public Member Functions

int add (string code, string name, string lecturer)
 
void show (string code)
 

Public Attributes

int count = 0
 
Course courses [MAX]
 

Detailed Description

Definition at line 12 of file user_commands.cpp.

Member Function Documentation

◆ add()

int Courselist::add ( string code,
string name,
string lecturer )
inline

Definition at line 15 of file user_commands.cpp.

15 {
16 if (count < MAX){
17 courses[count].code = code;
18 courses[count].name = name;
19 courses[count].lecturer = lecturer;
20 count++;
21 }
22 return 0;
23 }
string lecturer
string code
string name
Course courses[MAX]
const int MAX

References Course::code, count, courses, Course::lecturer, MAX, and Course::name.

Referenced by main().

Here is the caller graph for this function:

◆ show()

void Courselist::show ( string code)
inline

Definition at line 24 of file user_commands.cpp.

24 {
25 for (int i = 0; i < count; i++){
26 if (courses[i].code == code){
27 cout << "Name: " << courses[i].name << ", Lecturer: " << courses[i].lecturer << endl;
28 return;
29 }
30 }
31 }

References count, courses, Course::lecturer, and Course::name.

Referenced by main().

Here is the caller graph for this function:

Member Data Documentation

◆ count

int Courselist::count = 0

Definition at line 14 of file user_commands.cpp.

Referenced by add(), and show().

◆ courses

Course Courselist::courses[MAX]

Definition at line 13 of file user_commands.cpp.

Referenced by add(), and show().


The documentation for this struct was generated from the following file: