Hive Helsinki (School 42) 12th curriculum project (Rank04)
About · Modules · Requirements · Instructions
The repository contains several modules consisting of different exercises related to the basics of C++ programming.
CPP00
- ex00:
- familiarizes with basic C++ concepts such as string class, related functions and cout.
- ex01:
- introduces classes initialization, cin object of isstream class and further string manipulation and formatting possibilities such as .substr(), .setw(), and .length(). Additionally try / catch statements are used.
- Sets up a phone book by initialising a class 'PhoneBook', containing 8 classes of contacts
- user has options between the 3 commands
ADD
,SEARCH
andEXIT
which respectively adds contacts (and their details), searches for contacts (first displays entire list of contacts, then by entering index shows contact details) or exits the phone book - in case of invalid input, errors are displayed to the user
CPP01
- ex00:
- introduces new for allocating memory for a class
- learning about initialising classes on heap vs. stack
- ex01:
- learning about array of classes using new for memory allocation
- ex02:
- introduces concept of references
- ex03:
- reference vs. pointer to a class
- object which contains pointer to a class can be initialised without explicitly assigning value to the class whereby reference requires the object of the class not to be empty
- ex04:
- introduces concepts of ifstream and ofstream
- further string manipulation such as .find(), .erase(), .insert()
- user can give 3 arguments to the program (file name, string1 and string2), the content of the file given to the program is copied into another created file and then the sequence of string2 replaces sequence of string1 (if existing), prints errors in case of invalid arguments
- ex05:
- introduces concept of function pointers in C++
- ex06:
- introduces concept of switch statements
CPP02
CPP03
- ex00:
- sets up class for learning about inheritance in later exercises
- ex01:
- introduces concept of inheritance of classes
- initialisation of derived class, which inherits functions and members of base class
- as exercise requires, derived class member variables are initialised with different values
- virtual function and function override used in order to create unique behaviour of derived class function 'attack'
- additionally uses typeid in order to determine if base or derived class object called particular function for custom behaviour
- ex02:
- same as above, further derived class with different values of the member variables is created
CPP04
- ex00:
- sets up base class and two derived classes
- uses virtal functions and override in order to alter behaviour of derived classes' functions
- ex01:
- derived classes contain member variable to another class
- copy constructor creates deep copies of respective derived classes
- ex02:
- same as above, but base class is made abstract by declaring pure virtual function
-c++
compiler
To compile the executables of the different exercises, cd into the exercise folder in question and run:
$ make
To delete all files generated with make, run:
$ make fclean