Počet kreditů 4
Vyučováno v Summer
Rozsah výuky 2P+2C
Garant předmětu
Přednášející Josef Dobeš, Václav Navrátil, Petr Skalický, Stanislav Vítek
Cvičící Josef Dobeš, Václav Navrátil

The goal of the subject is to ensure necessary knowledge of the C language and main features of C++ as one of the dominant programming languages in many areas of research and technique (programming microprocessors, numerical mathematics, etc.). The skills on the language C/C++ are hence necessary for the work of students in various forms of projects, and for fulfillment of their final theses. The subject is based on the fundamental course of programming and algorithms in the first phase of study, which is mainly realized by means of Java programming language. The knowledge of syntax of Java (which have been derived from the C language) is hence an advantage for the study of this subject. The syllabus, therefore, contains an explanation of the differences of Java and C in the first stage. In this way, a guide of syntax of the fundamental features of the C language is naturally performed. The next lectures are devoted to the specific features of the C language as pointers, address arithmetic, etc. An explanation of structures and arrays of them follows. A review of the standard libraries of the C language is also performed. The subject is finished by the explanation of new features of the standards C99 and C++. At the beginning of this part of the subject, new data types are defined, novel types of input/output, and dynamic allocation of arrays are explained. An explanation of fundamental features of object programming in C++ follows, and an operation with the constructors and destructors is described. The explanation ends with class hierarchy and derived classes. A practical usage of operator overloading is demonstrated on the complex arithmetic. The exercises are organized in computer laboratories using the free environments as OpenWatcom, for example.

Recommended prerequisites: subject "Programming" - AE0B36PRI or AE0B36PR1
(according to the study program of student)

The goal of the subject is to ensure basic skills of the C/C++ programming language for standalone work of students in semester project and final theses.

1. Fundamentals of programming in C language, language characterization, compilation model, structure of program, headers, macros, preprocessor, conditional compilation, methods of debugging in C language
2. Differences between C and Java languages: variables, specifiers, retyping, operators. Control structures, cycles and break possibilities, input/output
3. Differences between C and Java languages: functions, calling by value or reference, prototypes, static variables, variables of register type, inline functions, blocks. Arrays, declaration and initialization, array elements, multidimensional arrays, access to array in functions
4. Pointers (1) and addresses, pointers and argument of functions
5. Pointers (2) and arrays, address arithmetics, access to parts of variables
6. Strings, functions operating with strings, pointers to characters, user-defined data types
7. Structures, data structures, array of structures, pointers to structures
8. Structures pointing to themselves, bit arrays, unions
9. Access to standard libraries, standard and formatted inputs and outputs, variable number of parameters (printf), format conversions
10. Access to files, system calls, peripheries (input/output), memory organization, dynamic memory management
11. New features of C language implemented in C99 and C++ standards (new data types, new types of inputs and outputs, dynamic array allocations)
12. Fundamental of object programming in C++, classes, data allocated to classes, static members of classes, constructors and destructors
13. Class hierarchy (private, protected, public), derived classes, friend functions, operator overloading, templates and exceptions
14. Reserve

1. Introduction, goal of exercises. Introduction to development tool. Preprocessor, conditional compilation. Basic structure of program, format of program, indenting, first program
2. Variables and arithmetics, program for recalculation of values, functions of standard input/output, formatting of calculated data. Program for copy of text from input to output with some modification
3. Working with various types of data, retyping, dividing variable to bytes
4. Function, creating and implementing function and checking its operation (rotation, inversion of bites, finding a number of bites in variable)
5. Operating with arrays (1), addition and multiplication of matrices, calculation of determinant, interpolation of function
6. Operating with arrays (2), array as parameter
7. Operating with pointers (1), modification of program by pointers
8. Operating with pointers (2), pointers to functions, pointers to pointers
9. Creating structures, unions
10. New data types in C99 and C++. Accuracy of arithmetics, kind declaration. New standard libraries, e.g., inputs and outputs (cin, cout, cerr). Dynamic array allocations, enhanced operating with arrays in C99 standard
11. Examples of creating classes and their usage. Meaning of constructors and destructors, multiple constructors. Static members of classes
12. Access to code and data in the case of private, protected, or public declarations. Usage of friend functions. Practical example of operator overloading - complex arithmetics
13. Test
14. Credit

Stroustrup, B.: The C++ Programming Language, 3rd edition, Addison-Wesley, Boston, 1997.

Rozvrh předmětu