Synopsys of the subject, requirements, algorithm, data, language, programming languages, why the C? specification, design, coding, testing, documenting, algorithm choice questions in connection with GCD (trial and error, prime factors, Euclidean formula), elements of algorithms: sequence, branching, cycles, n! calculation: algorithm selection, parts, data structure, narrative description of the algorithm, algorithm by block diagram, encoding; a small analysis: mandatory elements of a C program, the frame, the main function, return 0; the purpose and significance of indenting, scanf for reading integer values, printf for writing integer values. Storage units: variables, constants, functions; mandatory declaration / definition, syntax / semantics: Syntax diagram, syntax of an integer value, Basic syntax rules: free writing mode (white spaces), a != A, #preproc, / * comment * /, regular identifiers; predefined types, why we use int and double, constant int definition in dec, oct, hex forms, lack of the logic type, logic value of numbers. Instructions: ;, declaration/definition, expression instruction, conditional instruction, cycle (now just the while), control statements (switch/case just mentioned), {}, block diagram of if..else and while. Conditions: relational operators ('==' != '=', the dangers), logic operators !, &&, ||. Supplement and deepen the knowledge of the past week. control structures, instructions, built-in types, number representation. Use of library functions. Basic operators: arithmetic, integer, real, type cast, assignment, sizeof, relational, logic, bitwise, shortcut, ?:. Iterative solutions, =, pre/post ++ --, dangers of post, arrays, 1D, 2D, strings, pointers. 1D dynamic array (example of use), (only breefly, at the level of usage: getchar, putchar, EOF, ctrl+z/ctrl+d) filter program template, enum type, finite automaton example: writing out the comments from a C code, ly counter. Functions, memory areas allocated in the program, what is/will be where, the heap, behavior of the stack, the consequences of the differences. Storage classes (for local variables), the function call mechanism, multiple return values: void descart2polar(double, double, double*, double *), why forbidden to return local variable address. Struct, ., ->, typedef, direct selection sort, bubble sort, for structure array also, comparing functions, strcmp, sorting by text. Function pointers, useage of qsort. Making of string, int and double comparing funtion (by a structure array sorting example), introducing recursive structure, ONLY drawn. Unidirectional, bidirectional, "arranged according to several criteria" list, binary tree, coded only the search in the list by cycle. Managing lists, insertion, search, deleting functions, the two possible head handling: head=insert(head..., and insert (&head,..., interpretation of recursion by n!, binary tree management, inorder traversal only in code level. I/O, FILE fopen, fclose, feof, f/sprintf, f/sscanf, getc/s, Putc/s, parameters of main. In short, what is missed: the comma op, (union, bitfield vararg), the C preprocessor. Backup (if there is no need to make up missed lectures then: making programs from multiple source file).
Literature:
– B.W. Kernighan, D.M. Ritchie: The C Programming Language. Prentice Hall, 2nd edition, 1988. – D. Gookin: C All-in-One Desk Reference For Dummies, Wiley Publishing, Inc, 2004. |
Overview, C repeat, process of function call, const, make, purpose and possibilities of profiling. Number representation questions in simulations, inaccuracy, instability, InF, NaN, different real types, fitting function versions. Function overload, default arguments, inline function to replace macros, the reference type, dynamic memory management: new, new [], delete, delete []. Object-oriented programming concepts, principles, objects, classes, member variables and member functions, the this pointer, encapsulation, visibility and data hiding (complex number class). Constructors and destructors, exception handling, operator overload by member function and by global function (rational number class). Dynamic classes with members, copy constructor, assignment operator, the destructor. (Vector and matrix classes). Member variable initialization, constants and static members, namespaces, C++ I/O, overload of >> and << operator. Standard Template Library (STL) vector class, application examples, behavior of vector and simple C array as parameters/return value. STL string, vector algorithms (find, sort, transform, accumulate ...), further application examples. Function and class templates. Inheritance I. Objectives, derived class, base class, visibility, constructors/destructors. Succession II. Virtual functions, abstract classes, virtual destructor, heterogeneous collection. Some interesting elements of C++11.
Literature:
– B. Stroustrup: The C++ programming language Addison-Wesley, 3rd Edition, 2000. – A. Alexandrescu, H. Sutter: C++ Coding Standards: 101 Rules, Guidelines, and Best Practices, Addison-Wesley Professional; 1st ed. 2004. – Scott Meyers: Effective C++: 55 Specific Ways to Improve Your Programs and Designs, Addison-Wesley Professional; 3rd ed. 2005. |