SlideShare a Scribd company logo
 Submitted By Amir Hayat
 Submitted To Sir Imran
1. Functions
• Whitespace
1. Output Using cout
2. String Constants
3. Directives
4. Preprocessor Directives
5. Header Files
6. The using Directive
7. Comments
8. Comment Syntax
12. Alternative Comment Syntax
13. Integer Variables Defining
14. Integer Variables
15. Declarations and Definitions
16. Variable Names
17. Assignment Statements
18. Integer Constants
19. Output Variations
20. The endl Manipulator
21. Other Integer Types
22. Character Variables
23. Character Constants
24. Initialization
25. Escape Sequences
26. Input with cin
27. Cascading <<
28. Expressions
29. Precedence
30. Floating Point Types
31. Type float
32. Type double and long double
33. Floating-Point Constants
34. The constant Qualifier
35. The #define Directive
36. Type bool
37. The setw Manipulator
38. Cascading the Insertion Operator
39. Multiple Definitions
40. The IOMANIP Header File
41. Variable Type Summary
42. unsigned Data Types
43. Type Conversion
44. Automatic Conversions
45. Casts
46. Arithmetic Operators
47. The Remainder Operator
48. Arithmetic Assignment Operators
49. Increment Operators
50. Library Functions
51. Header Files
52. Library Files
53. Header Files and Library Files
54. Two Ways to Use #include
The Large Number of Program is Divided in Small Pieces and Each Part
Perform a Special Function
Example :
• Main()
• Printf()
The compiler ignores whitespace almost
completely.
cout << “Aami Kakakhel”;
The Text in quotation marks is to be displayed on the screen. The identifier
cout (pronounced “C out”) is actually an object. It is predefined in C++ to
correspond to the standard output stream
The operator << is called the insertion or put to operator.
it directs the string constant “Aami Kakakhel” to cout, which sends it to the
display.
The text in quotation marks, “Aami Kakakhel”, is an example of a string
constant. As you probably know, a constant, unlike a variable, cannot be given
a new value as the program runs. Its value is set when the program is written,
and it retains this value throughout the program’s existence. As we’ll see later,
the situation regarding strings is rather complicated in C++. Two ways of
handling strings are commonly used. A string can be represented by an array
of characters, or it can be represented as an object of a class. “Arrays and
Strings
The first two lines that begin the program are directives. The first
is a preprocessor directive, and the second is a using directive.
They’re not part of the basic C++ language, but they’re necessary
anyway.
The first line of the program,
#include <iostream>
might look like a program statement, but it’s not. It isn’t part of a function body
and doesn’t end with a semicolon, as program statements must. Instead, it starts
with a number sign (#). It’s called a preprocessor directive
The preprocessor directive #include tells the compiler to insert another file into your
source file
The preprocessor directive #include tells the compiler to add the source
file IOSTREAM to the source file before compiling
IOSTREAM is an example of a header file (sometimes called an include
file)
Example:
Header Files
Execute
A C++ program can be divided into different namespaces. A namespace is a
part of the program in which certain names are recognized; outside of the
namespace they’re unknown. The directive
using namespace std; says that all the program statements that follow are
within the std namespace. Various program components such as cout are
declared within this namespace
Comments are an important part of any program. They help the person
writing a program, and anyone else who must read the source file,
understand what’s going on. The compiler ignores comments, so they
do not add to the file size or execution time of the executable program
//Aami kakakhel
Comments start with a double slash symbol (//)
and terminate at the end of the line.
Comments are used for explain Source Code of A Programmer.
Or Explain Each Statement Of Source Code .
/* this is an old-style comment */
begins with the /* character pair and ends with */ (not with the end of the line)
this style is not generally used in C++. However
/* Alternative
Comment Is Written
In Many Line's like this */
Variable Mean Which Chang At time of execution.
Integer variables represent integer numbers Like 420 302 2016 etc
Integer Variables Have No fractional part
Example:
Source Program
Execute
Int x;
You must declare a variable before using it. However, you can place variable
declarations anywhere in a program. It’s not necessary to declare variables before the
first executable statement (as was necessary in C).
Example:
Source Program
Execute
A declaration introduces a variable’s name (such as var1) into a program
and specifies its type (such as int ). However, if a declaration also sets
aside memory for the variable, it is also called a definition
Example:
Source Program
Execute
The names given to variables (and other program features) are called identifiers
can use upper- and lowercase letters, and the digits from 1 to 9. You can also use the underscore (_).
The first character must be a letter or underscore. Identifiers can be as long as you like, but only the
first 247 characters (in Visual C++) or 250 characters (in C++ Builder) will be recognized. The
compiler distinguishes between upperand lowercase letters, so Var is not the same as var or VAR.
var1 = 20;
var2 = var1 + 10;
Assign values to the two variables. The equal sign =, as you might guess, causes
the value on the right to be assigned to the variable on the left. The = in C++ is
equivalent to the := in Pascal or the = in BASIC. In the first line shown here,
var1, which previously had no value, is given the value 20.
The number 20 is an integer constant. Constants don’t change
during the course of the program. An integer constant consists of
numerical digits. There must be no decimal point in an integer
constant, and it must lie within the range of integers
cout and the << operator know how to treat an integer
and a string differently. If we send them a string, they
print it as text. If we send them an integer, they print
Value Save In Integer Variable
Cout<<endl;
endl Manipulator is Used in Output for new line in C++.and In C
language We use /n in place of endl
Type char stores integers that range in value from –128 to 127. Variables
of this type occupy only 1 byte (eight bits) of memory. Character
variables are sometimes used to store numbers that confine themselves
to this limited range, but they are much more commonly used to store
ASCII characters
Character constants use single quotation marks around a character, like ‘a’ and
‘b’. (Note that this differs from string constants, which use double quotation
marks.)
When the C++ compiler encounters such a character constant, it translates it
into the corresponding ASCII code. The constant ‘a’ appearing in a program,
for example, will be translated into 97
Variables can be initialized at the same time
they are defined
The name reflects the fact that the backslash causes an “escape” from
the normal way characters are interpreted
Value Escape sequence
newline n
horizontal tab t
vertical tab v
backspace b
carriage return r
form feed f
Cin>>t;
The program to wait for the user to type in a number. The resulting
number is placed in the variable t.
Example:
Source Program
Execute
If we want to print some things in same time so we just us << and Write cout
just one time in same statement like
Cout<<“aami”<<abc;
Any arrangement of variables, constants, and operators that specifies a
computation is called an expression
When the Calculation is done in Expression so Value Become in Output
Example:
Source Program
Execute
All Parentheses are evaluate first
Multiplying, Division, and Modulus is 2nd But each have same level of
precedence if any expiration have each of then so calculate from lift to wright
At least addition and subtraction is also same level.
Example:
Source Program
Execute
Floating-point variables represent numbers with a decimal place—like
3.1415927, 0.0000625, and –10.2. They have both an integer part, to the
left of the decimal point, and a fractional part
Example:
Source Program
Execute
Type float stores numbers in the range of about 3.4×10–38 to 3.4×1038,
with a precision of seven digits
Example:
Source Program
Execute
The larger floating point types, double and long double, are similar to
float except that they require more memory space and provide a wider
range of values and more precision
The number 3.14159F in CIRCAREA is an example of a floating-point
constant. The decimal point signals that it is a floating-point constant, and
not an integer, and the F specifies that’s it’s type float, rather than double or
long double
Example:
Source Program
Execute
const float PI = 3.14159F;
float The keyword const (for constant) precedes the data type of a variable. It
specifies that the value of a variable will not change throughout the program
This directive sets up an equivalence between an identifier and a text phrase.
For example, the line
#define PI 3.14159
appearing at the beginning of your program specifies that the identifier PI will
be replaced by the text 3.14159 throughout the program. This construction has
Variables of type bool can have only two possible values: true and false.
In theory a bool type requires only one bit (not byte) of storage
We’ve mentioned that manipulators are operators used with the insertion
operator << to modify—or manipulate—the way data is displayed. We’ve
already seen the endl manipulator; now we’ll look at another one: setw, which
changes the field width of output.
Example:
Source Program
Execute
Variable Mean Which Chang At time of
execution.
Integer variables represent integer numbers
Like 420 302 2016 etc
Integer Variables Have No fractional part
Example:
Source Program
Execute
Int a,b,c;
We initialized the variables a, b, and c to specific values at the
same time we defined them
the same int keyword and separating the variable names with
commas. This saves space where a number of variables are all the
same type.
Keyword Low High Precision Memory
char –128 127 n/a 1
short –32,768 32,767 n/a 2
int –
2,147,483,648 2,147,483,647
n/a 4
long –
2,147,483,648
2,147,483,647 n/a 4
float 3.4 x 10–38 3.4 x 1038 7 4
double 1.7 x 10–308 1.7 x 10308 15 8
long double 3.4 x 10–4932 1.1 x 104932 19 10
Their range to start at 0 and include only positive numbers.
Example:
Source Program
Execute
When two operands of different types are encountered in the same
expression, the lower-type variable is converted to the type of the
higher-type variable.
Example:
Source Program
Execute
In case if calculation is an among the to different data type like float
and integer so the integer convert into temporary variable of type float
for calculation ta a time of calculation
Example:
Source Program
Execute
Sometimes a programmer needs to convert a value from one type to
another in a situation where the compiler will not do it automatically
or without complaining.
Example:
Source Program
Execute
C++ uses the four normal arithmetic operators +, -, *, and / for
addition, subtraction, multiplication, and division. These operators
work on all the data types, both integer and floating-point.
Example:
Source Program
Execute
There is a fifth arithmetic operator that works only with integer variables (types char,
short, int, and long). It’ s called the remainder operator, and is represented by %, the
percent symbol. This operator (also called the modulus operator) finds the
remainder when one number is divided by another. The REMAIND program
demonstrates the effect.
Example:
Source Program
Execute
There are arithmetic assignment operators +=, -=, *=, /=, and %= (and
some other operators as well)
Example:
Source Program
Execute
A++; = A=A+1;
++A
Prefix mean first execute then change it.
A++
Postfix mean first change then execute.
Example:
Source Program
Execute
There are a number of library function available in C/C++ Language that perform trigonometrically arithmetical and string
operations automatically.
These functions make programming muchsimpler in many situationsand save the Programmer’sEffort
The C language is accompaniedby a number of standard libraryfunctionswhich carryout various useful tasks. In particular,all
input and output operations (e.g., writing to the terminal) and all math operations (e.g., evaluation of sines and cosines) are
implemented bylibraryfunctions.
Example:
SOME EXAMPLES
A headerfileis a file with extension .h which contains C function declarations
and macro definitions to be shared between several source files. There are two
types of headerfiles: the filesthat the programmer writes and the filesthat
comes with your compiler.
Example:
Source Program
Execute
In programming, a library is a collection of precompiled routines that a program
can use. The routines, sometimes called modules, are stored in object format .
Libraries are particularly useful for storing frequently used routines because you
do not need to explicitly link them to every program that uses them
Example:
Source Program
Execute
A headerfileis a file with extension .h which contains C function declarations
and macro definitions to be shared between several source files. There are two
types of headerfiles: the filesthat the programmer writes and the filesthat
comes with your compiler.
Example:
Source Program
Execute
A headerfileis a file with extension .h which contains C function declarations
and macro definitions to be shared between several source files. There are two
types of headerfiles: the filesthat the programmer writes and the filesthat
comes with your compiler.
Example:
Source Program
Execute
Ad

More Related Content

What's hot (20)

Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
TAlha MAlik
 
C++ Tokens
C++ TokensC++ Tokens
C++ Tokens
Amrit Kaur
 
C++
C++C++
C++
Shyam Khant
 
Basic concept of c++
Basic concept of c++Basic concept of c++
Basic concept of c++
shashikant pabari
 
Learning C++ - Introduction to c++ programming 1
Learning C++ - Introduction to c++ programming 1Learning C++ - Introduction to c++ programming 1
Learning C++ - Introduction to c++ programming 1
Ali Aminian
 
45 Days C++ Programming Language Training in Ambala
45 Days C++ Programming Language Training in Ambala45 Days C++ Programming Language Training in Ambala
45 Days C++ Programming Language Training in Ambala
jatin batra
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
Rounak Samdadia
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
C++ Basics
C++ BasicsC++ Basics
C++ Basics
Himanshu Sharma
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
Praveen M Jigajinni
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
eteaching
 
C++ for beginners
C++ for beginnersC++ for beginners
C++ for beginners
Salahaddin University-Erbil
 
Intro to c++
Intro to c++Intro to c++
Intro to c++
temkin abdlkader
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
Huba Akhtar
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
Nilesh Dalvi
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++
HalaiHansaika
 
C++ Language
C++ LanguageC++ Language
C++ Language
Syed Zaid Irshad
 
Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions
khawajasharif
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
Sikder Tahsin Al-Amin
 
C++ programming intro
C++ programming introC++ programming intro
C++ programming intro
marklaloo
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
TAlha MAlik
 
Learning C++ - Introduction to c++ programming 1
Learning C++ - Introduction to c++ programming 1Learning C++ - Introduction to c++ programming 1
Learning C++ - Introduction to c++ programming 1
Ali Aminian
 
45 Days C++ Programming Language Training in Ambala
45 Days C++ Programming Language Training in Ambala45 Days C++ Programming Language Training in Ambala
45 Days C++ Programming Language Training in Ambala
jatin batra
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
eteaching
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
Nilesh Dalvi
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++
HalaiHansaika
 
Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions Beginner C++ easy slide and simple definition with questions
Beginner C++ easy slide and simple definition with questions
khawajasharif
 
C++ programming intro
C++ programming introC++ programming intro
C++ programming intro
marklaloo
 

Similar to C++ PROGRAMMING BASICS (20)

programming for problem solving in C and C++.pptx
programming for problem solving in C and C++.pptxprogramming for problem solving in C and C++.pptx
programming for problem solving in C and C++.pptx
BamaSivasubramanianP
 
C Programming - Basics of c -history of c
C Programming - Basics of c -history of cC Programming - Basics of c -history of c
C Programming - Basics of c -history of c
DHIVYAB17
 
Ch02
Ch02Ch02
Ch02
Arriz San Juan
 
The New Yorker cartoon premium membership of the
The New Yorker cartoon premium membership of theThe New Yorker cartoon premium membership of the
The New Yorker cartoon premium membership of the
shubhamgupta7133
 
Chapter2
Chapter2Chapter2
Chapter2
Anees999
 
Chapter3
Chapter3Chapter3
Chapter3
Kamran
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
AbrehamKassa
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
Tareq Hasan
 
C Programming Language Introduction and C Tokens.pdf
C Programming Language Introduction and C Tokens.pdfC Programming Language Introduction and C Tokens.pdf
C Programming Language Introduction and C Tokens.pdf
poongothai11
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
Vasuki Ramasamy
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
Vikram Nandini
 
fundamental of c++ for students of b.tech iii rd year student
fundamental of c++ for students of b.tech iii rd year studentfundamental of c++ for students of b.tech iii rd year student
fundamental of c++ for students of b.tech iii rd year student
Somesh Kumar
 
C programming
C programmingC programming
C programming
PralhadKhanal1
 
434090527-C-Cheat-Sheet. pdf C# program
434090527-C-Cheat-Sheet. pdf  C# program434090527-C-Cheat-Sheet. pdf  C# program
434090527-C-Cheat-Sheet. pdf C# program
MAHESHV559910
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
sajjad ali khan
 
lecture1 pf.pptx
lecture1 pf.pptxlecture1 pf.pptx
lecture1 pf.pptx
MalikMFalakShairUnkn
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
Qrembiezs Intruder
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
Muthuselvam RS
 
programming for problem solving in C and C++.pptx
programming for problem solving in C and C++.pptxprogramming for problem solving in C and C++.pptx
programming for problem solving in C and C++.pptx
BamaSivasubramanianP
 
C Programming - Basics of c -history of c
C Programming - Basics of c -history of cC Programming - Basics of c -history of c
C Programming - Basics of c -history of c
DHIVYAB17
 
The New Yorker cartoon premium membership of the
The New Yorker cartoon premium membership of theThe New Yorker cartoon premium membership of the
The New Yorker cartoon premium membership of the
shubhamgupta7133
 
Chapter3
Chapter3Chapter3
Chapter3
Kamran
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 
Introduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdfIntroduction to Programming Fundamentals 3.pdf
Introduction to Programming Fundamentals 3.pdf
AbrehamKassa
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
Tareq Hasan
 
C Programming Language Introduction and C Tokens.pdf
C Programming Language Introduction and C Tokens.pdfC Programming Language Introduction and C Tokens.pdf
C Programming Language Introduction and C Tokens.pdf
poongothai11
 
Unit 1 question and answer
Unit 1 question and answerUnit 1 question and answer
Unit 1 question and answer
Vasuki Ramasamy
 
fundamental of c++ for students of b.tech iii rd year student
fundamental of c++ for students of b.tech iii rd year studentfundamental of c++ for students of b.tech iii rd year student
fundamental of c++ for students of b.tech iii rd year student
Somesh Kumar
 
434090527-C-Cheat-Sheet. pdf C# program
434090527-C-Cheat-Sheet. pdf  C# program434090527-C-Cheat-Sheet. pdf  C# program
434090527-C-Cheat-Sheet. pdf C# program
MAHESHV559910
 
C++ programming language basic to advance level
C++ programming language basic to advance levelC++ programming language basic to advance level
C++ programming language basic to advance level
sajjad ali khan
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
Rasan Samarasinghe
 
Tutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng verTutorial basic of c ++lesson 1 eng ver
Tutorial basic of c ++lesson 1 eng ver
Qrembiezs Intruder
 
Ad

C++ PROGRAMMING BASICS

  • 1.  Submitted By Amir Hayat  Submitted To Sir Imran
  • 2. 1. Functions • Whitespace 1. Output Using cout 2. String Constants 3. Directives 4. Preprocessor Directives 5. Header Files 6. The using Directive 7. Comments 8. Comment Syntax 12. Alternative Comment Syntax 13. Integer Variables Defining 14. Integer Variables 15. Declarations and Definitions 16. Variable Names 17. Assignment Statements 18. Integer Constants 19. Output Variations 20. The endl Manipulator
  • 3. 21. Other Integer Types 22. Character Variables 23. Character Constants 24. Initialization 25. Escape Sequences 26. Input with cin 27. Cascading << 28. Expressions 29. Precedence 30. Floating Point Types 31. Type float 32. Type double and long double 33. Floating-Point Constants 34. The constant Qualifier 35. The #define Directive 36. Type bool 37. The setw Manipulator 38. Cascading the Insertion Operator 39. Multiple Definitions 40. The IOMANIP Header File 41. Variable Type Summary 42. unsigned Data Types 43. Type Conversion 44. Automatic Conversions 45. Casts 46. Arithmetic Operators 47. The Remainder Operator 48. Arithmetic Assignment Operators 49. Increment Operators 50. Library Functions 51. Header Files 52. Library Files 53. Header Files and Library Files 54. Two Ways to Use #include
  • 4. The Large Number of Program is Divided in Small Pieces and Each Part Perform a Special Function Example : • Main() • Printf()
  • 5. The compiler ignores whitespace almost completely.
  • 6. cout << “Aami Kakakhel”; The Text in quotation marks is to be displayed on the screen. The identifier cout (pronounced “C out”) is actually an object. It is predefined in C++ to correspond to the standard output stream The operator << is called the insertion or put to operator. it directs the string constant “Aami Kakakhel” to cout, which sends it to the display.
  • 7. The text in quotation marks, “Aami Kakakhel”, is an example of a string constant. As you probably know, a constant, unlike a variable, cannot be given a new value as the program runs. Its value is set when the program is written, and it retains this value throughout the program’s existence. As we’ll see later, the situation regarding strings is rather complicated in C++. Two ways of handling strings are commonly used. A string can be represented by an array of characters, or it can be represented as an object of a class. “Arrays and Strings
  • 8. The first two lines that begin the program are directives. The first is a preprocessor directive, and the second is a using directive. They’re not part of the basic C++ language, but they’re necessary anyway.
  • 9. The first line of the program, #include <iostream> might look like a program statement, but it’s not. It isn’t part of a function body and doesn’t end with a semicolon, as program statements must. Instead, it starts with a number sign (#). It’s called a preprocessor directive The preprocessor directive #include tells the compiler to insert another file into your source file
  • 10. The preprocessor directive #include tells the compiler to add the source file IOSTREAM to the source file before compiling IOSTREAM is an example of a header file (sometimes called an include file) Example: Header Files Execute
  • 11. A C++ program can be divided into different namespaces. A namespace is a part of the program in which certain names are recognized; outside of the namespace they’re unknown. The directive using namespace std; says that all the program statements that follow are within the std namespace. Various program components such as cout are declared within this namespace
  • 12. Comments are an important part of any program. They help the person writing a program, and anyone else who must read the source file, understand what’s going on. The compiler ignores comments, so they do not add to the file size or execution time of the executable program
  • 13. //Aami kakakhel Comments start with a double slash symbol (//) and terminate at the end of the line.
  • 14. Comments are used for explain Source Code of A Programmer. Or Explain Each Statement Of Source Code .
  • 15. /* this is an old-style comment */ begins with the /* character pair and ends with */ (not with the end of the line) this style is not generally used in C++. However /* Alternative Comment Is Written In Many Line's like this */
  • 16. Variable Mean Which Chang At time of execution. Integer variables represent integer numbers Like 420 302 2016 etc Integer Variables Have No fractional part Example: Source Program Execute
  • 17. Int x; You must declare a variable before using it. However, you can place variable declarations anywhere in a program. It’s not necessary to declare variables before the first executable statement (as was necessary in C). Example: Source Program Execute
  • 18. A declaration introduces a variable’s name (such as var1) into a program and specifies its type (such as int ). However, if a declaration also sets aside memory for the variable, it is also called a definition Example: Source Program Execute
  • 19. The names given to variables (and other program features) are called identifiers can use upper- and lowercase letters, and the digits from 1 to 9. You can also use the underscore (_). The first character must be a letter or underscore. Identifiers can be as long as you like, but only the first 247 characters (in Visual C++) or 250 characters (in C++ Builder) will be recognized. The compiler distinguishes between upperand lowercase letters, so Var is not the same as var or VAR.
  • 20. var1 = 20; var2 = var1 + 10; Assign values to the two variables. The equal sign =, as you might guess, causes the value on the right to be assigned to the variable on the left. The = in C++ is equivalent to the := in Pascal or the = in BASIC. In the first line shown here, var1, which previously had no value, is given the value 20.
  • 21. The number 20 is an integer constant. Constants don’t change during the course of the program. An integer constant consists of numerical digits. There must be no decimal point in an integer constant, and it must lie within the range of integers
  • 22. cout and the << operator know how to treat an integer and a string differently. If we send them a string, they print it as text. If we send them an integer, they print Value Save In Integer Variable
  • 23. Cout<<endl; endl Manipulator is Used in Output for new line in C++.and In C language We use /n in place of endl
  • 24. Type char stores integers that range in value from –128 to 127. Variables of this type occupy only 1 byte (eight bits) of memory. Character variables are sometimes used to store numbers that confine themselves to this limited range, but they are much more commonly used to store ASCII characters
  • 25. Character constants use single quotation marks around a character, like ‘a’ and ‘b’. (Note that this differs from string constants, which use double quotation marks.) When the C++ compiler encounters such a character constant, it translates it into the corresponding ASCII code. The constant ‘a’ appearing in a program, for example, will be translated into 97
  • 26. Variables can be initialized at the same time they are defined
  • 27. The name reflects the fact that the backslash causes an “escape” from the normal way characters are interpreted Value Escape sequence newline n horizontal tab t vertical tab v backspace b carriage return r form feed f
  • 28. Cin>>t; The program to wait for the user to type in a number. The resulting number is placed in the variable t. Example: Source Program Execute
  • 29. If we want to print some things in same time so we just us << and Write cout just one time in same statement like Cout<<“aami”<<abc;
  • 30. Any arrangement of variables, constants, and operators that specifies a computation is called an expression When the Calculation is done in Expression so Value Become in Output Example: Source Program Execute
  • 31. All Parentheses are evaluate first Multiplying, Division, and Modulus is 2nd But each have same level of precedence if any expiration have each of then so calculate from lift to wright At least addition and subtraction is also same level. Example: Source Program Execute
  • 32. Floating-point variables represent numbers with a decimal place—like 3.1415927, 0.0000625, and –10.2. They have both an integer part, to the left of the decimal point, and a fractional part Example: Source Program Execute
  • 33. Type float stores numbers in the range of about 3.4×10–38 to 3.4×1038, with a precision of seven digits Example: Source Program Execute
  • 34. The larger floating point types, double and long double, are similar to float except that they require more memory space and provide a wider range of values and more precision
  • 35. The number 3.14159F in CIRCAREA is an example of a floating-point constant. The decimal point signals that it is a floating-point constant, and not an integer, and the F specifies that’s it’s type float, rather than double or long double Example: Source Program Execute
  • 36. const float PI = 3.14159F; float The keyword const (for constant) precedes the data type of a variable. It specifies that the value of a variable will not change throughout the program
  • 37. This directive sets up an equivalence between an identifier and a text phrase. For example, the line #define PI 3.14159 appearing at the beginning of your program specifies that the identifier PI will be replaced by the text 3.14159 throughout the program. This construction has
  • 38. Variables of type bool can have only two possible values: true and false. In theory a bool type requires only one bit (not byte) of storage
  • 39. We’ve mentioned that manipulators are operators used with the insertion operator << to modify—or manipulate—the way data is displayed. We’ve already seen the endl manipulator; now we’ll look at another one: setw, which changes the field width of output. Example: Source Program Execute
  • 40. Variable Mean Which Chang At time of execution. Integer variables represent integer numbers Like 420 302 2016 etc Integer Variables Have No fractional part Example: Source Program Execute
  • 41. Int a,b,c; We initialized the variables a, b, and c to specific values at the same time we defined them the same int keyword and separating the variable names with commas. This saves space where a number of variables are all the same type.
  • 42. Keyword Low High Precision Memory char –128 127 n/a 1 short –32,768 32,767 n/a 2 int – 2,147,483,648 2,147,483,647 n/a 4 long – 2,147,483,648 2,147,483,647 n/a 4 float 3.4 x 10–38 3.4 x 1038 7 4 double 1.7 x 10–308 1.7 x 10308 15 8 long double 3.4 x 10–4932 1.1 x 104932 19 10
  • 43. Their range to start at 0 and include only positive numbers. Example: Source Program Execute
  • 44. When two operands of different types are encountered in the same expression, the lower-type variable is converted to the type of the higher-type variable. Example: Source Program Execute
  • 45. In case if calculation is an among the to different data type like float and integer so the integer convert into temporary variable of type float for calculation ta a time of calculation Example: Source Program Execute
  • 46. Sometimes a programmer needs to convert a value from one type to another in a situation where the compiler will not do it automatically or without complaining. Example: Source Program Execute
  • 47. C++ uses the four normal arithmetic operators +, -, *, and / for addition, subtraction, multiplication, and division. These operators work on all the data types, both integer and floating-point. Example: Source Program Execute
  • 48. There is a fifth arithmetic operator that works only with integer variables (types char, short, int, and long). It’ s called the remainder operator, and is represented by %, the percent symbol. This operator (also called the modulus operator) finds the remainder when one number is divided by another. The REMAIND program demonstrates the effect. Example: Source Program Execute
  • 49. There are arithmetic assignment operators +=, -=, *=, /=, and %= (and some other operators as well) Example: Source Program Execute
  • 50. A++; = A=A+1; ++A Prefix mean first execute then change it. A++ Postfix mean first change then execute. Example: Source Program Execute
  • 51. There are a number of library function available in C/C++ Language that perform trigonometrically arithmetical and string operations automatically. These functions make programming muchsimpler in many situationsand save the Programmer’sEffort The C language is accompaniedby a number of standard libraryfunctionswhich carryout various useful tasks. In particular,all input and output operations (e.g., writing to the terminal) and all math operations (e.g., evaluation of sines and cosines) are implemented bylibraryfunctions. Example: SOME EXAMPLES
  • 52. A headerfileis a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. There are two types of headerfiles: the filesthat the programmer writes and the filesthat comes with your compiler. Example: Source Program Execute
  • 53. In programming, a library is a collection of precompiled routines that a program can use. The routines, sometimes called modules, are stored in object format . Libraries are particularly useful for storing frequently used routines because you do not need to explicitly link them to every program that uses them Example: Source Program Execute
  • 54. A headerfileis a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. There are two types of headerfiles: the filesthat the programmer writes and the filesthat comes with your compiler. Example: Source Program Execute
  • 55. A headerfileis a file with extension .h which contains C function declarations and macro definitions to be shared between several source files. There are two types of headerfiles: the filesthat the programmer writes and the filesthat comes with your compiler. Example: Source Program Execute