You are on page 1of 46

LEVEL-1

NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
EXTRA
EXTRA
EXTRA
NOTES

PREPROCESSING AND STANDARD LIBRARIES






It is the directives written in a program.

It is always before the main().

It does not terminated by semicolon sign.

Most useable when our program are more Larger
and has to managed multiple files.
#
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES
NOTES

NOTES
NOTES
Increment & Decrement Operator

Increment & Decrement Operator is two type
i. Pre Increment / Decrement Operator -
Increase/ Decrease the variable values then print e.g. ++a / --a
ii. Post Increment / Decrement Operator
Print the variable values then Increase / Decrease e.g. a++/a--
#include<iostream.h>
#include<conio.h>
void main()
{
int a=5;
clrscr();
cout<<\nValue of a in 1
st
Step = <<a;
cout<<\nValue of a in 2
nd
Step =<<++a;
cout<<\nValue of a in 3
rd
Step = <<a;
cout<<\nValue of a in 4
th
Step = <<a++;
cout<<\nvalue of a in 5
th
Step = <<a;
getch();
}
NOTES
NOTES
EXTRA
NOTES
NOTES
Input from User

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
cout<<Enter 1
st
Number\n;
cin>>a;
cout<<Enter 2
nd
Number\n;
cin>>b;
cout<<Value of 1
st
No =<<a;
cout<<value of 2
nd
No = <<b;
c=a+b;
cout<<Sum of two no = <<c;
getch();
}

Syntax Error
It occurs when grammatical error has found.

EX:-
int a
Here semicolon sign missing so it is related
through C program grammar So, Syntax error occur.



EXTRA
Symantic Error
This type of error occur when statement
are not meaningful.

EX:-
a+b = c;
It is wrong assignment here
statement are not meaningful here should
be c = a+b.
EXTRA
Type Error
This type of error occur when datatype
mismatch.

Ex:- int a = 3.5;
char c = 4;
Here a is integer variable so it can
not hold floating value and in second line c is
the character variable and it can not integer
value.
EXTRA
Logical error
This type of error occur when your
statement is logically incorrect.

Ex:-
int i =1;
while(i>=10) /*value of i never be greater than 10*/
{
cout<<\n<<i;
}
EXTRA
Run time Error
This type of error occur during run time or
execution time.


Ex:- You are trying to open a file which
does not exist it will occur run time error.
Its another example is , you are making
Infinite loop.(endless loop).
EXTRA

You might also like