Professional Documents
Culture Documents
Class11 Project
Class11 Project
FILE
INTRODUCTION
Name: Vidhi Singh
Class: 11th-D
Roll no.: 11450
Subject: Computer
Technology
& Programming
Submitted to:
Mrs.Garima Saxena
Signature:
PREFACE
This project has covered the course of
class 11th Computer Technology and
Programming given by the Board of
Secondary Education, Rajasthan as an
optional subject. The programming is
prepared to make the student aware of
the knowledge based on 11th CTP course.
I have tried to concern the best
available source of information in the
respective subject for the completion
of this file. I have tried my level
best to include all topics covering
the syllabus. I look to all the
construction feedback and suggestions
for the improvement of this report.
Vidhi Singh
XI-D
ACKNOWLEDGEMENT
I would like to express my sincere
gratitude to my CTP teacher Mrs.
Garima Saxena for their vital support,
guidance and encouragement without
which this project would not have come
forth from my side.
I would respect our Principal sir Mr.
Pawan Maheshwari who has given us the
opportunity to have Computer
Technology and Programming as an
optional paper. He has put in all
efforts for the benefit of students
and provides us a wonderful
environment & required infrastructure.
I would like to thank my parents and
friends who have helped me with their
valuable suggestions and guidance
which has been helpful in various
phases of the completion of this
project.
Vidhi Singh
XI-D
CERTIFICATE
This is to certify that Ms.Vidhi Singh
daughter of Mr.Shailendra Singh bearing
roll no.:11450, has accomplished her
project based on the syllabus of 11th
Computer Technology & Programming.
According to the curriculum of Rajasthan
Board of Secondary Education, Ajmer of
standard 11th. This report has to be done
by the student opting CTP as an optional
subject. This project report is prepared
under the guidance and instructions of
Mrs. Garima Saxena. This project report
is complied with all the rules and
regulations lead by the Board of
Secondary Education, Ajmer, Rajasthan
for the session 2018-19.
Date: / /
CONTENTS
1.About‘C’Language
2. Programming in ‘C’
Language
3.Object Oriented
Programming
4.Introduction to C++
5.programming in C++
ABOUT
LANGUAGE
ABOUT‘C’LANGUAGE
‘C’ is a programming language. ‘C’
language was first developed in 1972 by
Dennis Ritchie at A.T. Bell Labs.
Ritchie Called his newly developed
language ‘C’ simply because there was a
‘B’ programming language already, ‘C’
language is high level language. Infact
‘C’ is one of the most popular general
purpose programming language. It is a
case sensitive language. It has been
closely associated with the UNIX
operating system where it was developed,
since most of the programs that run on
it are written in ‘C’ language. It
supports to write high level as well as
low level language, therefore, it is
also known as middle level language. It
is highly portable, structured,
processor machine, independent and
platform independent language. It
supports primitive data type as well as
user defined data type for representing
complex data type as per user’s
requirement. It supports modular
programming. Due to this facility ,
program debugging is easy and simple to
write large programs in module.
PROGRAM TO PRINT YOUR
NAME ON SCREEN
output:
My name is Vidhi.
PROGRAM TO CALCULATE SUM
OF ANY TWO NUMBERS
Output:
Enter first no.:2
Enter second no.:2
Sum:4
PROGRAM TO CALCULATE
SIMPLE INTEREST
/*Program to find simple interest*/
#include<stdio.h>
#include<conio.h>
void main()
{
int p,r,t,si=0;
clrscr();
printf("Enter principle:");
scanf("%d",&p);
printf("Enter rate of interst:");
scanf("%d",&r);
printf("Enter time:");
scanf("%d",&t);
si=(p*r*t)/100;
printf("Simple Interst:%d",si);
getch();
}
Output:
Enter principle:7
Enter rate of interest:7
Enter time:7
Simple Interest:3
TYPE CONVERSION OF
EXPRESSION
In computer science, type
conversion or typecasting refers to
changing an entity of one datatype into
another. There are two types of
conversion: implicit and explicit. The
term for implicit type conversion
is coercion. Explicit type conversion in
some specific way is known as casting.
Explicit type conversion can also be
achieved with separately defined
conversion routines such as an
overloaded object constructor.
Output:
X=14.500000
X=0.875000
CONTROL STATEMENT
(1)Simple if statement:
In this statement, condition is
checked first, if it is true then it
will executes statement group
otherwise not. Statements group can be
one or more than one statements.
SYNTAX:
If(condition)
{
Statement
}
PROGRAM TO EXPLAIN SIMPLE IF
STATEMENT
Output:
Enter number:16
It is an even number.
(2) if-else statement:
This statement tests a condition, if
the condition is true, then first
group of statement executes and if
false then second group executes.
SYNTAX:
if(condition)
{
Set of statement 1
}
Else
{
Set of statement 2
}
PROGRAM TO EXPLAIN if-else
STATEMENT
Output:
Enter first number:45
Enter second number:55
Second number is greater
(3)Nested if-else statement:
When a if-else statement is written
in another if-else, then it is
called as nested if-else statement.
SYNTAX:
if(condition 1)
{
if(condition 2)
{
Statement 1
}
else
{
Statement 2
}
else
{
Statement 3
}
else
{
Statement 4
}
PROGRAM TO EXPLAIN NESTED
if-else STATEMENT
Output:
Enter any number from 1 to 7:-3
Wednesday
LOOPING
Output:
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
while loop:
While loop is entry controlled loop.
It is used when we don’t know how
many times a loop is to be executed.
Until the condition is true it will
execute otherwise the loop execution
will be stopped.
SYNTAX:
while (condition)
{
Looping body
}
PROGRAM TO EXPLAIN while LOOP
/*Program to print numbers from 1 to
10*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i=1;
clrscr();
while(i<=10)
{
printf("%d\n",i);
i++;
}
getch();
}
Output:
1
2
3
4
5
6
7
8
9
10
do-while loop:
It is a exit controlled loop. In
this loop, first the loop body will
be executed and then the condition
will be checked, it means this loop
will execute at least one time. This
loop will be executed until the
condition is true otherwise it will
be terminated.
SYNTAX:
do
{
Loop body
}
while (condition);
PROGRAM TO EXPLAIN do-while LOOP
Output:
50
52
54
56
58
60
Nested Loop:
A loop may contain another loop in
its body. This form of a loop is
called nested loop. But in a nested
loop, the inner loop must terminate
before the outer loop.
SYNTAX:
for (condition)
{
for (condition)
{
}
}
PROGRAM TO EXPLAIN NESTED LOOP
/*Program to print tables of 1 to
10*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=10;i++)
{
j=1;
while(j<=10)
{
printf("%d\t",i*j);
j++;
}
printf("\n");
}
getch();
}
OUTPUT:
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
5 10 15 20 25 30 35 40 45 50
6 12 18 24 30 36 42 48 54 60
7 14 21 28 35 42 49 56 63 70
8 16 24 32 40 48 56 64 72 80
9 18 27 36 45 54 63 72 81 90
10 20 30 40 50 60 70 80 90 100
break statement:
Break statement enables to print a
program o skip over part of the
code. A break statement skips the
rest of the loop and jumps over to
the statement following the loop.
SYNTAX:
break;
continue statement:
The continue statement is another
jump statement somewhat like the
break statement as both of the
statements skip over a part of the
code. continue statement is little
different from break statement,
instead of forcing termination, it
forces the next round of the loop to
take place, skipping any code in
between.
SYNTAX:
continue;
PROGRAMMiN
g
IN
‘C’ LaNGUaGE
Array
An array is a finite collection of similar
or homogenous data stored in adjacent
memory locations. By finite means that
there are specific numbers of elements in
an array and by similar means that all the
elements in an array are of same type.
for eg. An array may contain all integers
and all characters but not both.
Declaration of array:
In declaration of array three things are
used:
1. Array type
2. Array name
3. Number of elements in array
When an array is declared then memory space
is allotted equal to the array size. Array
is declared as follows:
<Array type> <Array name> <[Size]>
Eg. int mark[50];
Here, int mark[50] tells that marks array
having size 50 and it can store integers.
Eg. float salary[100];
double total[20];
char emp-name[20];
Types of array:
Mainly array is of two types:
1. One dimensional array
2. Multi dimensional array
Structure
We have learnt about array which can store
one type of element. But structure can
contain various types of element. So in a
structure a user can use int, float,
double, char & array data. Every element of
structure is known as member.
Declaration of structure:-
Declaration of structure is difficult
because it declares each member in
structure- syntax for declaring a structure
is-
struct <tag>
{
<data type> member 1;
<data type> member 2;,member 3;
………………………………………
………………………………………
<data type> member n;
};
In above structure struct is a keyword. Tag
is a identifier of structure & member 1 ,
member 2 ,…… member n are declared as
different – different members.
OUTPUT:
Name:vidhi singh
Roll no.:50
Physics:55
Chemistry:78
Marks in Physics:55
Marks in Chemistry:78
Object
Oriented
Programming
Object Oriented Programming
Object-oriented programming (OOP) is
a programming paradigm based on the concept of
"objects", which may contain data, in the form
of fields, often known as attributes; and code,
in the form of procedures, often known
as methods. A feature of objects is that an
object's procedures can access and often modify
the data fields of the object with which they are
associated (objects have a notion of "this" or
"self"). In OOP, computer programs are designed
by making them out of objects that interact with
one another.[1][2] There is significant diversity
of OOP languages, but the most popular ones
are class-based, meaning that objects
are instances of classes, which typically also
determine their type.
Many of the most widely used programming
languages (such as C++, Object Pascal, Java,
Python etc.) are multi-paradigm programming
languages that support object-oriented
programming to a greater or lesser degree,
typically in combination
with imperative, procedural programming.
Significant object-oriented languages
include Java, C++, C#, Python, PHP, JavaScript, R
uby,Perl, Object Pascal, Objective-
C, Dart, Swift, Scala, Common Lisp, and
Smalltalk.
Object-oriented programming uses objects, but not
all of the associated techniques and structures
are supported directly in languages that claim to
support OOP. The features listed below are,
however, common among languages considered
strongly class- and object-oriented (or multi-
paradigm with OOP support), with notable
exceptions mentioned.
Features of Object Oriented Programming :-
thereafter.
Many other programming languages have been influenced
by C++, including C#, D, Java, and newer versions of
C.
Programming
in ‘C++’
Programs:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"My name is Vidhi Singh";
getch();
}
OUTPUT:
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"Enter first no.:";
cin>>a;
cout<<"Enter second no.:";
cin>>b;
c=a+b;
cout<<"Sum:"<<c;
getch();
}
OUTPUT:
Enter First no.:2
Enter second no.:2
Sum:4
3.Program to find area of rectangle.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int l,b,area=0;
cout<<"Enter length of the
rectangle:";
cin>>l;
cout<<"Enter breadth of the
rectangle:";
cin>>b;
area=l*b;
cout<<"Area of the
Rectangle:"<<area;
getch();
}
OUTPUT:
Enter length of the rectangle:2
Enter breadth of the rectangle:1
Area of the rectangle:2
4.Program to find area of square.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int s,area=0;
cout<<"Enter side of the square:";
cin>>s;
area=s*s;
cout<<"Area of the Square:"<<area;
getch();
}
OUTPUT:
Enter side of the square:3
Area of the square:6
5. Program to find area of circle.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int r,area=0;
cout<<"Enter radius of the circle:";
cin>>r;
area=22.7*r*r;
cout<<"Area of the circle:"<<area;
getch();
}
OUTPUT:
Enter radius of the circle:4
Area of the circle:363
6. Program to find Simple Interest.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int p,r,t,si=0;
cout<<"Enter Principle:";
cin>>p;
cout<<"Enter rate:";
cin>>r;
cout<<"Enter time:";
cin>>t;
si=(p*r*t)/100;
cout<<"Simple Interest:"<<si;
getch();
}
OUTPUT:
Enter Principle:5000
Enter rate:5
Enter time:5
Simple Interest:60
7. Program to find greater between
two numbers.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"Enter a:";
cin>>a;
cout<<"Enter b:";
cin>>b;
if(a>b)
cout<<"a is greater";
else
cout<<"b is greater";
getch();
}
OUTPUT:
Enter a:4
Enter b:9
b is greater
8. Program to print your name 10
times.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i;
for(i=0;i<10;i++)
cout<<"My name is Vidhi\n";
getch();
}
OUTPUT:
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
My name is Vidhi
9. Program to find given no. is even
or odd.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n;
cout<<"Enter number:";
cin>>n;
if(n%2==0)
cout<<"Number is even";
else
cout<<"Number is odd";
getch();
}
OUTPUT:
Enter number:66
Number is even
10. Program to print all even
numbers between 2 & 20.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i;
for(i=2;i<=20;i+=2)
{
cout<<i;
cout<<"\n";
}
getch();
}
OUTPUT:
2
4
6
8
10
12
14
16
18
20