Anda di halaman 1dari 10

INTRODUCTION OF C&C++

C is a computer based progamaming language.It is


developed in 1972 by KEN THOMPSON and DENNIS
RITCHIE at bell laboratories in USA.C is a midddle
level language .It is also called as twin sister of pascal
language because syntex of pascal and c is quite
similar.
In 1983, the name of the languge was changed from c
with classes to C++. This was developed by BJARNE
STROUSTRUP .C++ includes some add on features
such as classes basic inheritance,inlining and default
argument functions.It is a high level language.
CHARACTER SET OF C CONTAINS

a to z (small letters)
A to Z (capital letters)
0 to 9 (numeric charaters)
Special characters like; : = < > # / \ () {} [] + @ - %
& etc.
Escape sequences ( \n \t \f \r \b \o)
Logical operater :
1. && AND
2. || OR
3. ! NOT
BASIC DATA TYPES IN C &C++
Primary data types
Character data type : 1 byte storage
Integer : 2byte storage
Float :4 byte storage
Double :8 byte storage
Void : 0 byte storage

Derived data types


Arrays
pointers
functions
loop
A loop is a special type of construct which allows
repetition of certain steps defined in its body .
A loop contain set of statements which are executed
again and again in a program till a condition is true.
The c language provides three loop constructs:
1. For loop
2. While loop
3. Do while loop
For loop
For loop is normally used when we want to execute a
set of statement repeatedly for a fixed number of
times.
# syntex of for loop
for( initilization part; conditional
part;increment/decrement)
{
set of statements;
}
Program of for loop
#include<stdio.h>
#include>conio.h>
void main()
{
int i;
clrscr();
for(i=0;i<=5;i++)
{
printf(hello);
}
getch();
}
While loop
while loop is used when a set of statement are to be
excuted again to again .the set statement written in
while loop will be executed until the condition
/express is true (non zero).
Syntex of while loop:
While (condition / expression)
{
set of statement;
increment/decrement;
}
Program of while loop
#include<stdio.h>
#include<conio.h>
Void main()
{
int a;
clrscr();
a=1;
while (a<=10)
{
printf(\n%d,a);
a++;
}
}
Do while loop
Do while is similar to while loop,but in do while loop
condition is checked after execution of body of
loop.The set of statements of the loop gets executed
repeatedly till the condition/expression remains true.
Syntex of do while loop
{
set of statements;
}
While(condition or expression);
Program of do while loop
#include<stdio.h>
#include<conio.h>
Void main()
{
int ch=0;
clrscr();
printf(\n\t ASCII code character);
do
{
printf(\n\n\t%d%c,ch,ch);
ch++;
if(ch%22==0)
getch();
}
While(ch<=255);
getch();
}

Anda mungkin juga menyukai