Politechnika Śląska - strona 289

Types

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Computer Programming
Pobrań: 0
Wyświetleń: 602

Types  stronger type control (compared to C) - to permit error detection by the compiler  automatic type conversions - when it does not lead to ambiguity  whenever it is possible, no precision or information is lost; not guaranteed for all conversions: char/short/int/long/single/float/double/sig...

Why to learn C++

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Computer Programming
Pobrań: 0
Wyświetleń: 448

Why to learn C++  More scalable than C - project size - number of programmers  Reuse code written by you and others - many libraries available  Many tools and other languages are based on C++  It has become a standard ...

File inclusion

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 511

File inclusion  Any source line of the form #include " filename " or #include is replaced by the contents of the file filename  Where is the file included - for ”f ilename .h” - in the same directory, where the source program (if not found - like ) - for - in a directory defined by th...

Log and Exp

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 595

Log, exp...  exp(x) exponential function e x  log(x) natural logarithm ln(x), x 0  log10(x) base 10 logarithm log 10 (x), x 0  pow(x,y) x y ; a domain error occurs if x=0 and y=0 ...

Make and a Makefile

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 455

make and a Makefile  A typical makefile contains lines of the following types: - macros (”variable definitions”) - dependency rules  explicit rules  implicit rules - comments  Example: # Our...

Signal

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 630

 Often used in Unix systems  Facilities for handling exceptional conditions that arise during execution: - interrupt signal from an external source - an error in execution. void (*signal(int sig, void (*handler) (int))) (int)  signal determines how subsequent signals will be handled  If handle...

Standard Predefined Macros

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 532

Standard Predefined Macros  __FILE__ - This macro expands to the name of the current input file, in the form of a C string constant  __LINE__ - This macro expands to the current input line number, in the form of a decimal integer constant  Example

Trigonometric functions

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 455

Trigonometric functions  Angles are always expressed in radians  Parameters and results are doubles - sin(x) sine of x - cos(x) cosine of x - tan(x) tangent of x - asin(x) sin -1 (x), x in [-1,1] - acos(x) cos -1 (x), x in [-1,1] - atan(x) tan -...

Associativity

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Computer Programming
Pobrań: 0
Wyświetleń: 637

Associativity  assignment and unary operators are of right associativity a=b=c is equivalent to a=(b=c)  remaining ones are of left associativity a+b+c is equivalent to (a+b)+c ...

Strncpy

  • Politechnika Śląska
  • dr inż. Piotr Fabian
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 665

Strncpy  char *strncpy(char *dest, const char *src, size_t maxlen);  Copies at most maxlen characters of src to dest  The target string might not be null-terminated if the length of src is maxlen or more #include #include int main(void) { char string[10]; char *str1 = "first"; strncp...