0% found this document useful (0 votes)
236 views6 pages

C++ Handwritten

This document provides an introduction to structured programming in C++. It discusses key concepts like data types, operators, variables, constants, and expressions. Some main points covered include: - Structured programming uses a top-down, hierarchical approach and supports some object-oriented concepts. - Data types include basic types like int, float, char, and string, as well as user-defined types. - Operators perform arithmetic, assignment, comparison, and logical operations. Operator precedence follows PEMDAS rules. - Variables and constants are named memory locations that can (variables) or cannot (constants) change value during execution.

Uploaded by

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

C++ Handwritten

This document provides an introduction to structured programming in C++. It discusses key concepts like data types, operators, variables, constants, and expressions. Some main points covered include: - Structured programming uses a top-down, hierarchical approach and supports some object-oriented concepts. - Data types include basic types like int, float, char, and string, as well as user-defined types. - Operators perform arithmetic, assignment, comparison, and logical operations. Operator precedence follows PEMDAS rules. - Variables and constants are named memory locations that can (variables) or cannot (constants) change value during execution.

Uploaded by

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

Programming in C++

INTRODUCTION TO STRUCTURE PROGRAMMING:-


• Structured programming known as modular programming .
• It is subset of Procedural (Function Oriented ) Programming language.
• It maintain a Hierarchical (top-down approach)Structure.
• It takes / supports some Object Oriented Programming Concept.(OOPs) .
• Eg:-C , C++ , Java etc…

DATA TYPES:-
• Data Type means signature (type )of a data.
• User Defined means User/Programmer can define of his own data Types.
• Built-in(System In-Built) means already developed by Developer.
• Derived means User can Derive from Built-in and User-define data Types.

Simple data Types:


• Known as Integer Type of data.
• It takes 2 bytes memory space.
• Syntax:- int num = 5; //int- Data Types , num- Variable
Floating data Types:
• Known as Float(Decimal/Fraction)Type of Data.
• It takes 4 bytes memory space.
• Syntax:- float num = 5.32; //float- Data Types , num- Variable
Character data Types:
• Known as Only letter Type of Data.
• It takes 1 byte (4bits->0/1) memory space.
• Syntax:- char letter = 'D'; //char- Data Types , letter-Variable

String data Types:


• Known as Combination of letters(Words) Type of Data.
• It takes 4 byte memory space.
• Syntax:- string text = "Hello"; // string- Data Types ,text-Variable

OPERATORS:-
• Operators are the symbols that executes some operations like
Addition,Subtration,Multiplication,Logical Operation,Modolus etc.
• Eg:- int sum1 = 100 + 50; // int-DataType;sum1-variable;+:-
Arithmatic Operator

❖ Arithmetic operators:- Execute Arithmetic Operation only like


+,-,*,/ etc.
❖ Assignment operator:- (=)It assign the value.
Eg:- int a = 5;
❖ Comparision operator:- (==,>,<,<=)It compare value
with other.
Eg:- int a >5;
❖ Logical operator:- (&&,||,!)It execute the logical operation.
Eg:- int a!=5; // !-Logical Not
Eg:- a==5 && b==10; // &&-Logical And
Eg:- a==5 || b==10; // &&-Logical Or

Operator Precedence:
Operator Precedence means Giving Priority to The Operators by which the
can executed.
Eg:- int a = 10 + 20 * 30 // 10+60 = 70
It Follows The BODMAS Rule of Simple Mathematics.
VARIABLE AND CONSTANT AND DECLARATION:-
• Variable:- Variable is a Named Memory Which changes/Vary its value
during execution.
• Constant:- Constant is a Named Memory Which does not Change /Vary its
value during execution.
• Declaration:-
Constant Decl.
const int i = 10; // const-Keyword(constant);int-Data Type;
Variable Decl.
int i ;
float b,c; // int,float –Data Types; I,b,c value should be vary in run time.

VARIABLE VS CONSTANT Difference:-


EXPRESSIONS :-
• A combination of variables, constants and operators that represents a
computation forms an expression.
• Eg:- int a=5;
Float b=10.5,sum;
Sum = a+b; //Here all Single line is an expression .

• integral expressions: int a=5;


• Float expressions: float b=1.2;
• Relational or Boolean expressions: int a>5;
• Logical expressions: a==5 && b==6;

You might also like