Professional Documents
Culture Documents
Started With
C++
C++ CHARACTER SET
Character set is a set of valid characters that a language can
recognise. A character represents any letter, digit, or any other sign.
These are reserved for special purpose and must not be used as
normal identifier names.
Some of the keywords in c++
asm continue float new signed try
auto default for operator sizeof typrdef
break delete friend private static union
case do goto protected struct unsigned
catch double if public switch virtual
char else inline register template void
class enum int return this volatile
const extern long short throw while
Identifiers
Identifiers are names of the program given by user.
Rules to write identifiers
1. Do not start with digits.
2. No special symbols are used except _(underscore).
3. Upper-case And Lower-case are different.
4. No spaces are used.
Types of operators
1. Unary operators
2. Binary operators
3. Ternary operators
Unary operators
Unary operators are those operators that
require one operator to operate upon.
Arithmetic operators
Logical operators
Relational Operators
Conditional Operators
Arithmetic operators
+(addition)
–(subtraction)
*(multiplication)
/(division)
%(reminder/modulus)
Logical operators
&& (Logical AND)
|| (Logical OR)
Logical operator
?
:
Relational operators
< (Less than)
<=(Less than or equal to)
>(Greater than)
>=(greater than or equal to)
== (equal to)
!= (not equal to)
A First look at C++ Program
Why include iostream.h ?
Types of comments:
Example:-
#include<iostream.h>
Void main() // the program about addition.
Multi line comments
The block comments, mark the beginning of comment with
/* and end with */.
That means, everything that falls between/*and*/ is
considered as comment.
Example:-
#include<iostream.h>
Void main() /*the program is about addition*/
Using I/O operators
Output operator “ << “
Types of errors:
1. Syntax Errors
2. Semantic Errors
3. Type Errors
4. Run-time Errors
5. Logical Errors
Syntax Errors are occurred when rules of the program is
misused i.e., when grammatical rule of C++ is violated.
Ex:- int a, b (semicolon missing)
Type Errors are occurred when the data types are misused.
Ex:-int a; a=123.56;
Run-time Errors are occurred at the time of execution.