Structures
- Politechnika Śląska
- Computer Programming
Structures Structures in C++ are classes too struct A { contents... } is equivalent to class A { public: contents... } ...
Ta witryna wykorzystuje pliki cookie, dowiedz się więcej.
Structures Structures in C++ are classes too struct A { contents... } is equivalent to class A { public: contents... } ...
3D libraries General idea: - define lighting, viewpoint etc. - define 3D objects - leave the rest of the work the graphical engine Usually used with a hardware accelerated video card ...
stdlib.h: atof double atof(const char *s) Converts a string to double - ASCII string to floating point number Problems with error detection (always returns a number) Better control: strtod ...
Avoiding duplicate code for the preprocessor Important! An example of a header file bool.h: #ifndef BOOL_H #define BOOL_H enum bool {false, true}; #endif ...
Error messages Get a system error message char *strerror( int errnum ); Constants extern int _doserrno; extern int errno; extern char *_sys_errlist[ ]; extern int _sys_nerr; ...
Hyperbolic functions sinh(x) hyperbolic sine of x cosh(x) hyperbolic cosine of x tanh(x) hyperbolic tangent of x ...
OpenGL void DisplayCallback(void) { glClear(GL_COLOR_BUFFER_BIT); /* Draw a triangle */ glBegin(GL_TRIANGLES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(.5, 0.0, 0.0); glVertex3f(.5, .5, 0.0); glEnd(); glFlush(); } ...
Qsort Sorting of data - a common task performed by computers There are many methods of sorting One of the fastest is Quick Sort ...
Reading data from the keyboard Functions: - getc(), gets(), scanf() - fgetc(), fgets(), fscanf() The keyboard is usually line buffered Do not use gets() ...
Truncating ceil(x) smallest integer not less than x , as a double floor(x) largest integer not greater than x , as a double ...