Saturday 11 July 2015

C++ Concepts

Now that we have discussed control structures, (here and here), let us learn a few other important C++ concepts and operators.

"sizeof()" Operator
•Unary operator
•Usable with variables as well as data types
  Sizeof(double)
  int x;

  cout << sizeof(x);


Types of Errors
•Syntax Errors
–Not following the C++ grammar rules
–Some Examples
•Missing out ; at the end of statement
•Not declaring a variable but using it
•Misspelled keywords
•Runtime Errors
–Occur when a program can not do what it has been asked to do
–Compiler can not detect them
–Some Examples
•Division by 0
•Opening a file that does not exist
•Logic Errors
–Design Flaw
–Some Examples
Adding instead of subtracting

The difficulty in detecting these errors increases in the same order they are mentioned in, that is, syntax errors are least difficult to detect, where as logic errors are the hardest to detect.


Logical Operators
§Logical AND
  &&
§Logical OR
  ||
§Logical NOT

  !

About the Author

Unknown

Editorial Team

Post a Comment

 
Codexify © 2015 - Designed by Templateism.com