NPRG041: Programming in C++
Materials |
Classes |
Deadlines |
Activity |
Assignments
Basic Information
- Annotation:
Czech |
English
-
Course webpage
- Practical classes
- Group 07: Monday 10:40 - 12:10 (SW2) [Czech]
- Group 08: Monday 12:20 - 13:50 (SW2) [Czech]
- Group 09: Monday 15:40 - 17:10 (SW2) [English]
-
Table with activity points
Lab Materials
Practical Classes
- Monday 02. 10. 2023: 01 - Subsets
- Organizational information
- Project structure, compilation, function main, program exit codes
- Include directives, standard libraries, problem decomposition, user-defined functions, modifier const
- Standard output stream std::cout, stream insertion operator <<
- Traditional array and its size, type size_t, basics of static and dynamic allocation
- Monday 09. 10. 2023: 02 - Options I - Files:
Messages.txt
- Modules, header and source files, declarations and definitions, program arguments
- Traditional strings and strings std::string, container std::vector, type aliases, basics of loops and iterators, universal reference
- Passing of parameters (value, pointer, reference), function parameters (default values, output parameters), global named constants (const, constexpr)
- Monday 16. 10. 2023: 03 - Options II - Files:
Messages.txt
- Parsing of numbers, functions std::stoi and std::stof
- Handling of exceptions (basic principles), structure struct, full and partial namespace unfolding, comments
- Monday 23. 10. 2023: 04 - Counter - Files:
Input.txt |
Output.txt |
Exceptions.txt
- Streams and files (read and write operations), standard streams std::cin, std::cout, streams std::istream, std::ostream, std::ifstream, std::ofstream
- Function std::getline (whole line granularity), functions std::isdigit and std::isalpha
- Classes with static methods, function name overloading, traditional pointers (nullptr literal)
- Handling of exceptions (throwing and catching string exceptions)
- Monday 30. 10. 2023: 05 - Database I - Files:
Movies.csv |
Exceptions.txt
- Classes with data members and methods (without inheritance), naming convention for private members, inline functions
- Parameterized constructors (parameters passed by value, constant reference, or rvalue reference)
- Member initializer lists (for class data members), initialization of standard containers
- Container std::set (containing items with predefined ordering), stream std::istringstream, function std::getline (with custom separator)
- Function std::move, emplace mechanism principles (emplace_back method on std::vector)
- Monday 06. 11. 2023: 06 - Expressions I
- Non-trivial class hierarchy with simple inheritance, access specifiers for member visibility (public, protected, private), inheritance access levels (public, protected, private)
- Virtual functions, abstract classes and pure virtual functions, final classes, inheritance of constructors, virtual destructors, function overriding
- Dynamic allocation (individual items with non-trivial life cycle), operators new (allocation, construction) and delete (destruction, deallocation), safe deallocation
- Enumeration classes (enum class), general principle of wrapper classes
- Monday 13. 11. 2023: 07 - Expressions II
- Polymorphic container (containing traditional pointers to base class instances), advanced work with traditional pointers
- Container std::stack, operations push, top, and pop
- Shunting-yard algorithm (method for parsing arithmetical or other expressions in infix notation)
- Memory leaks avoidance (ensuring atomicity of potentially unsuccessful chained dynamic allocations)
- Handling of exceptions (custom hierarchy of exception classes), std::bad_alloc exception
- Monday 20. 11. 2023: 08 - Database II - Files:
Actor.h |
Movies.csv |
Movie.h |
Titles.csv |
Exceptions.txt
- Container std::set (containing items without predefined ordering), custom comparison operator <
- Custom stream insertion << and extraction >> operators (with default separator)
- Member initializer lists (invocation of ancestor constructors), construct friend (class level), default and delete specifiers
- Shared smart pointers (std::shared_ptr, function std::make_shared), invocation of virtual functions via smart pointers
- Polymorphic container (containing smart pointers to base class instances), code refactoring principles
- Dynamic casting (traditional retyping, conversion operators dynamic_cast and std::dynamic_pointer_cast)
- Monday 27. 11. 2023: 09 - Database III - Files:
Queries.h
- Containers std::map and std::multimap (items with / without predefined global ordering operators, structure std::less, custom ordering)
- Structure std::pair, inner components first and second, function std::make_pair
- Methods insert, emplace, find, equal_range, lower_bound, and upper_bound for map containers
- General concept of functors (function objects) and lambda expressions, input parameters and/or return values
- Containers std::unordered_map and std::unordered_multimap (custom std::hash template specialization, global comparison operator ==, structure std::equal_to)
- Copy elision, observer pointer, structured bindings (map pairs)
- Standard Template Library (STL) (standard algorithms for working with containers)
- Functions std::copy, std::copy_if, std::remove_if, and std::erase, batch container construction
- Function std::sort, ordering comparators and filtering predicates (custom functors or lambda expressions), function std::for_each
- Monday 04. 12. 2023: 10 - Matrix
- General concept of templates, basic templates for classes and global functions (type name and value parameterization), dependent names and typename construct
- Container std::array, method fill
- Custom arithmetic operators (addition, multiplication, pre/postincrementation, ...) and two-level indexing operators (both modifiable and read-only variants)
- Inner classes, reference data members in classes, const_cast casting
- Monday 11. 12. 2023: 11 - Array I
- Custom elastic array container
- Manual dynamic allocation, functions malloc and free, placement new operator, explicit destructor invocation
- Initializer list constructors, structure std::initializer_list
- Standard exceptions, conditional sections using ifdef directives
- Monday 18. 12. 2023: 12 - Array II
- Copy and move constructors and assignment operators, functions std::swap and std::move, noexcept keyword, Rule of Three / Five
- Nested templates, custom conversion operators
- Custom iterators (forward iterator, bidirectional iterator, random access iterator)
- User-defined namespaces
- Doxygen documentation
- Monday 08. 01. 2024: Credit test
Important Deadlines
- Sunday 17. 12. 2023: selection of the credit program topic
- Sunday 19. 05. 2024: submission of the completed credit program
- Sunday 30. 06. 2024: possible adjustments of the credit program
Small Assignments
- Sunday 08. 10. 2023: C01 - Subsets - Instructions: Czech (version 5) | English (version 3)
- Sunday 15. 10. 2023: C02 - Options I - Instructions: Czech (version 7) | English (version 2)
- Sunday 22. 10. 2023: C03 - Options II - Instructions: Czech (version 7) | English (version 2)
- Sunday 29. 10. 2023: C04 - Counter - Instructions: Czech (version 6) | English (version 1)
- Sunday 05. 11. 2023: C05 - Database I - Instructions: Czech (version 7) | English (version 1)
- Sunday 12. 11. 2023: C06 - Expressions I - Instructions: Czech (version 5) | English (version 1)
- Sunday 19. 11. 2023: C07 - Expressions II - Instructions: Czech (version 4) | English (version 1)
- Sunday 26. 11. 2023: C08 - Database II - Instructions: Czech (version 8) | English (version 2)
- Sunday 03. 12. 2023: C09 - Database III - Instructions: Czech (version 3) | English (version 1)
- Sunday 10. 12. 2023: C10 - Matrix - Instructions: Czech (version 4) | English (version 2)
- Sunday 17. 12. 2023: C11 - Array I - Instructions: Czech (version 3) | English (version 2)
- Thursday 28. 12. 2023: C12 - Array II - Instructions: Czech (version 3) | English (version 2)
Big Assignments
- Thursday 23. 11. 2023: A01 - Regular expressions - Instructions: Czech (version 5) | English (version 1)
- Wednesday 03. 01. 2024: A02 - Graphs - Instructions: Czech (version 7) | English (version 2)