0% found this document useful (0 votes)
23 views14 pages

Dilkhush Kumar (C++ Language)

c++

Uploaded by

DILKHUSH KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views14 pages

Dilkhush Kumar (C++ Language)

c++

Uploaded by

DILKHUSH KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

C++ language

Introduction: C++ is a general-purpose programming language that was developed as an


extension of the C programming language. It was created by Bjarne Stroustrup in the early
1980s at Bell Labs in USA 1983 (version 1.0) im 1989 (version 2.0) in 1992 (version 3.0).
Initially for designing small and simple programs the machine level language was
never be used as the previous approach. paid in designing such large and complex application
and to allow for complex to the return a new approach known as object-oriented approach was
invented.

STRUCTURE PROGRAMING APPROCH

• Object oriented approach: - It enables the creation of well-organized and understandable


code by modeling real-world entities using classes and objects.
• Programs are divided into objects and functions.
• It lays more focus on what to do and not how to solve a given problem.
• Object in the system communicate is each other using the concept or message passing.
• Modification and meantness of a program is very easy as if you want to modify the data
in an object then only function of that object need to the return.
• It is easy to understand the structure add the working of complex system.
• It is supporting reusability of support.
➢ Difference between C language and C++ language?

FLOWCHART

Flowchart: -A flowchart is a type of diagram hat represents a workflow or process. A


flowchart can also be defined as a diagrammatic representation of an algorithm, a step by step
approach to solving a task.

symbol Purpose Description

Flow line Indicates the flow of logic


by connecting symbols.
Represents the start and
the end of a flowchart.
Terminal (Stop/Start)

Used for arithmetic


Processing operations and
datamanipulations.

Used for decision making


Decision between two or more
alternatives.

Used to join different


On-page Connector flowline

Off-page Connector Used to connect the


flowchart portion on a
different page.

Predefined
Process/Function Represents a group of
statements performing
one processing task.

Used for input and output


operation.
Input/Output
ALGORITHAM

Algorithm; -Algorithm are components that perform algorithmic operations on


containers and other sequences. The C++ standard provides some standard algorithms
collected in the<algorithm>standard header. A handful of algorithms are also in the
<numeric>header.

Q. Write a C++ algorithm to write a program to add two


numbers?
• Steps are given below:

1. Start

2. Accept num1, num 2

3. Sum= num1+ num2

4. Display sum

5. Stop
EXPERIMENT NO:-1

Q. Write a program to add two number?

#include<iostream.h>

#include<conio.h> int

main()

int a,b,sum; cout<<"enter

number a="; cin>>a;

cout<<"enter number b=";

cin>>b; sum=a+b;

cout<<"sum is="<<sum;

getch();

return 0;

OUTPUT:-
EXPERIMENT:-2
Q. Write a program to substract two number?
#include<iostream.h>
#include<conio.h> int
main()
{
int a,b,substract;
cout<<"enter number a=";
cin>>a;
cout<<"enter number b=";
cin>>b; substract=a-b;
cout<<"substract is="<<substract;
getch();
return 0;
}

OUTPUT:-
EXPERIMENT NO:-3
Q. Write a program to multiply two numbers?
#include<iostream.h>
#include<conio.h> int
main()
{
int a,b,multiply;
cout<<"enter number a=";
cin>>a;
cout<<"enter number b=";
cin>>b; multiply=a*b;
cout<<"multiply is="<<multiply;
getch();
return 0;
}

OUTPUT:-
EXPRIMENT NO:-4
Q. write a program to division two number?
#include<iostream.h>
#include<conio.h> int
main()
{
int a,b,division;
cout<<"enter number a=";
cin>>a;
cout<<"enter number b=";
cin>>b; division=a/b;
cout<<"division is="<<division;
getch();
return 0;
}

OUTPUT:

EXPRIMENT NO:-5
Q. Program to convert temperature given in Fahrenheit to the one in Celsius?

#include<iostream.h>
#include<conio.h> int
main()
{
Float c,f;
Cout<<” enter temperature in Fahrenheit=”; C=(float)5/9*(f-32);
cout<<"temperature in Celsius ="<<c;
getch();
return 0;
}

OUTPUT:-

EXPRIMENT NO:-6
Q. Program to calculate the area and parameter of a rectangle?
#include<iostream.h>
#include<conio.h> int
main ()
{
Int length,width,area,perimeter;
Cout<<” enter length” <<end l;
Cin>>length;
Cout<<” enter width” <<end l;
Cin>>width;
Area=l*b; Perimeter=2*(l+b);

cout<<"area is=” <<area<<end l;

cout<<” perimeter is=” <<perimeter;

getch();
return 0;
}

OUTPUT: -

EXPRIMENT NO:-7
Q. Program to calculate the simple interest?
#include<iostream.h>
#include<conio.h> int
main ()
{
Float p,f,t,si;
Clrscr;
Cout<<”enter principal rate time=n”;
Cin>>p>>r>>t; Si=(p*r*t)/100;
cout<<"simple interest ="<<si;
getch();
return 0;
}

OUTPUT: -

 Variables: Variable is the name of a memory location which stores some data.
▪ Variables Rules:
1. Variables are case sensitive
2. 1st character is alphabet or '_'
3. no comma/blank space
4. No other symbol other than '_’
 Constants: Values that don't change(fixed)
Type

Integer Constants Character Constants RealConstants1


(1,2,3,4) ( a,b,A,B) (1.0,2.0,3.14,2.3)

Keywords: Reserved words that have special meaning to the compiler.(32 keywords in c)

 Comments: Lines that are not part of program


1.single line; //
2.multiple line: /,/
Output:
1.integer: printf(" age is %d ", age);
2.real number: printf(" value of pi is %f ", pi);
3.Character: printf(" star looks like this %c ", star);

OPERATORS
a. Arithmetic Operators
b. Relational Operators
d. Bitwise Operators
c. Logical Operators
e. Assignment Operator
f. Ternary Operatar

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy