< Understanding C++
Preprocessor
#include <stdio.h>includes contents of stdio.h
#error textdisplay text as compile time error
#warning textdisplay text as compile time warning
#pragmacompiler specific options
#define Mdefine M
#undef Mundefine M
#if (condition)conditional compiling
#ifdef Mcompiled if M is defined
#ifndef Mcompiled if M is not defined
#elif (condition)conditional compiling
#elseconditional compiling
#endifend conditional section
defined()is macro defined.
!defined()is macro not defined
M ## Dcombines M and D into MD
#Mtreat M as string "M"
Syntax
if (bool expr) block [else block]
for ([expr];[condition];[expr]) block
while (condition) block
do { } while (condition)
type identifier([type identifier, ...]);
type identifier([type identifier, ...]) { }
class identifier [:[private|public] type, ...];
class identifier [:[private|public] type, ...] { [private:] };
struct identifier [:[public|private] type, ...];
struct identifier [:[public|private] type, ...] { [public:] };
union identifier;
union identifier { type identifier; ... };
enum identifier;
enum identifier { identifier [=int_value], ... }';
typedef type identifier;
Logical AND (&&) and Logical OR (||) Lookup Table

Logical OR:

OR True False
True
True
True
False
True
False


Logical AND:

AND True False
True
True
False
False
False
False

Logical XOR:

XOR True False
True
False
True
False
True
False
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.