While doing programming in any programming language, you need to use various variables to store various information. Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory.
You may like to store information of various data types like character, wide character, integer, floating point, double floating point, boolean etc. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.
This Powerpoint presentation covers following topics of C Plus Plus:
Features of OOP
Classes in C++
Objects & Creating the Objects
Constructors & Destructors
Friend Functions & Classes
Static data members & functions
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
This Powerpoint presentation covers following topics of C Plus Plus:
Features of OOP
Classes in C++
Objects & Creating the Objects
Constructors & Destructors
Friend Functions & Classes
Static data members & functions
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
Structured Languages- Need and Characteristics of OOP, Data Types and Modifiers, Arrays, Classes, Objects, Pointers, References, Difference between Pointers and References, Inheritance, Constructors, Destructors, and Polymorphism.
Presented By:
N.V.Raja Sekhar Reddy
www.technolamp.co.in
Want more interesting...
Watch and Like us @ https://www.facebook.com/Technolamp.co.in
subscribe videos @ http://www.youtube.com/user/nvrajasekhar
it is written in a very simple language.generally ,it will help students of first year to achieve success in this language . one can easily score good marks after reading from this note.
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and ... Note: This page does not list esoteric programming languages. .... Computer programming portal ...
It includes:
Introduction to Graphs
Applications
Graph representation
Graph terminology
Graph operations
Adding vertex and edge in Adjacency matrix representation using C++ program
Adjacency List implementation in C++
Homework Problems
References
Our Facebook Page url: https://www.facebook.com/programming.cplusplus
C++ language was developed by Bjarne Stroustrup. C++ is just C with classes where class is a user-defined datatype just like structure but with more advance features of object-oriented programming language.
An object is a variable of type class which is created during runtime. That's why the objects are allocated memory in heap and are called as reference types.
Static variables scope remains within the whole program. IT is not reinitialised again and again. We can declare the members of a class as static as well. Both possess same properties.
Our Facebook page:
https://www.facebook.com/programming.cplusplus/
Definition of Computer
Classification of Computer
Applications of Computer
Block Diagram and Working of Computer System
Different Peripheral Devices
Main Storage and Auxiliary Storage Devices
Computer Hardware and Software
Nowadays, Wireless Sensor Network has been greatly used
with RFID technology because of its certain advantages. RFID
is abbreviated as radio frequency identification. The frequency
identification RFID technology is similar to a Wireless Sensor
Network (WSN) as it also captures the physical environment
data, process it and provide the rapid response about location
and target tracking [3]. RFID active tags are connected with
sensors to communicate with users [4]. RFID technology uses
radio waves to communicate the data and other necessary
information. It includes RFID tags and RFID readers. The
tags are equipped on an object which we want to sense. It
can discover the information about that object even without
coming in contact with it. The data is then send to the host
system through intranet. RFID can easily discern the objects
and can trace the location even if no information about the
physical position is provided. The main difference is that RFID
provides much more and accurate information about physical
environment than a Wireless Sensor Network could provide.
There is a major drawback of this technology which is its
lowest communication range up to 12m only due to limited
battery problem. This drawback can be made insignificant by
integrating it with WSN. As a result, combination of RFID and
WSN can provide us with a bundle of environment related
information such as how the data is routed by the nodes,
which routing protocol is used, resource ID, location and ID of
communicating nodes and also the physical condition of nodes.
80 percent of the node’s energy is utilized during the process
of communication, processing, and activation [3]. Figure 1
shows the advantages that we can have by integrating these
two technologies.
If any class have multiple functions with same names but different parameters then they are said to be overloaded. Function overloading allows you to use the same name for different functions, to perform, either same or different functions in the same class.
If you have to perform one single operation but with different number or types of arguments, then you can simply overload the function.
C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX
Most C++ compilers don't care what extension you give your source code, but if you don't specify otherwise, many will use .cpp by default
Most frequently used and free available compiler is GNU C/C++ compiler, otherwise you can have compilers either from HP or Solaris if you have respective Operating Systems.
With Remote Desktop Connection, you can connect to a computer running Windows from another computer running Windows that's connected to the same network or to the Internet. For example, you can use all of your work computer's programs, files, and network resources from your home computer, and it's just like you're sitting in front of your computer at work.
To connect to a remote computer, that computer must be turned on, it must have a network connection, Remote Desktop must be enabled, you must have network access to the remote computer (this could be through the Internet), and you must have permission to connect. For permission to connect, you must be on the list of users. Before you start a connection, it's a good idea to look up the name of the computer you're connecting to and to make sure Remote Desktop connections are allowed through its firewall.
To find the Remote Desktop Connection shortcut, click the Start button Start button, click All Programs, and then click Accessories. To quickly open Remote Desktop Connection, click the Start button Start button, type mstsc in the search box, and then press Enter.
Redirecting a device on your computer makes it available for use in a Remote Desktop session. If a Remote Desktop Connection dialog box appears after you click Connect and enter your credentials, you can redirect local devices and resources, such as your local drives or Clipboard. Click Details, and then select the check box for each item you want to redirect.
An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations.
C language supports a rich set of built-in operators. An operator is a symbol that tells the compiler to perform certain mathematical or logical manipulations. Operators are used in program to manipulate data and variables.
A pointer is a variable whose value is the address of another variable, i.e., direct address of the memory location. Like any variable or constant, you must declare a pointer before you can use it to store any variable address.
There are few important operations, which we will do with the help of pointers very frequently. (a) we define a pointer variable (b) assign the address of a variable to a pointer and (c) finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand.
Garbage Value:
If any variable is not initialized then that variables having garbage value(unassigned value).
For example:
int i;
Variable ‘i’ is integer type but it wont assign any value.so,it take garbage value.It maybe any value.
Before allocating memory in run time system does not clear the memory before allocating the variable.So,default value of the variable is garbage value.
My Tours and Travels Project. New user can login and book their travel. description of various places with their maps is also given.
Editing the new records of customers and tourists by administrator.
2) Verifying customers(tourists) registration and complaint forms filled by visitors.
3) Creation of new admin by administrator.
4) Viewing of accounts information by customer online.
5) Creation of new records of tours, number of days and nights, bookings and customers.
6) Amending the records of existing customers and administrator.
7) Each customer or member of the ‘Country Drive’ having unique id and password.
8) Viewing all the details of his/her account, tours and bookings
9) Only administrator can grant permission for bookings, view customers, add customer and admin etc.
10) Password confirmation for customers and admin is applied.
11) Viewing of receipts and balance by tourists and customers.
12) Previous records of customers are also available to admin.
13) Full Proof and ease to use online tour booking, handling services & registration.
14) Admin can add max 2 advertisements on the home page of the website.
15) Also there is complaint form for visitors to enquire about the tours and their booking during, before or after their travel.
16) There are tour details of every tour, description of popular places and their photographs to make tourists know more about the place they are going to visit.
This presentation is all about the wireless sensor networks, how they collect data using aggregation, and how they evaluate or calculate the parameters
Safalta Digital marketing institute in Noida, provide complete applications that encompass a huge range of virtual advertising and marketing additives, which includes search engine optimization, virtual communication advertising, pay-per-click on marketing, content material advertising, internet analytics, and greater. These university courses are designed for students who possess a comprehensive understanding of virtual marketing strategies and attributes.Safalta Digital Marketing Institute in Noida is a first choice for young individuals or students who are looking to start their careers in the field of digital advertising. The institute gives specialized courses designed and certification.
for beginners, providing thorough training in areas such as SEO, digital communication marketing, and PPC training in Noida. After finishing the program, students receive the certifications recognised by top different universitie, setting a strong foundation for a successful career in digital marketing.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
2. IDENTIFIERS
• Identifiers are the names of things that appear
in the program. Such names are called as identifiers.
All identifiers must obey the following rules:
1. It is a sequence of characters that consists of
letters, digits and underscores.
2. It must start with a letter or underscore. It can
not start with a digit.
3. It cannot be a reserved word.
4. It can be of any length.
C++ is a case-sensitive so area, Area and AREA are
All different identifiers.
3. VARIABLES
• Variables are used to store values so that these
Values can be used later in the program.
• They are called variables because their values can
be changed.
• The values to variables can be reassigned also.
• Example: radius=1.0; //compute 1st area
area= radius*radius*3.14;
cout<<area;
radius=2.0; //compute 2nd area
area=radius*radius*3.14;
cout<<area;
4. VARIABLE DECLARATION
• To use a variable, you declare it by telling the
compiler its name and what type of data it represents.
This is called Variable Declaration.
datatype variable_name;
It tells the compiler to allocate the appropriate
memory space for the variable based on its data type.
int count;// declare count to be an integer variable
int count=1; OR //2 statements are equivalent to
int count=1;
5. DATATYPE
• Datatype means what are the various types of
data that a variable can hold.
• The compiler allocates memory space to store
each variable according to its datatype.
Imagine this Notebook as a variable
NoteBook name
C++
Initially book
Is empty means
You have not
defined the variable
6. Data Types
Data types are means to identify the type
of data and associated operation of
handling it .
C++ has three types of data types :-
• Built in data type.
• Derived data type.
• User defined data type.
7.
8.
9. Built in data type
Built in data types are those who are
not composed of other data types.
There are mainly 5 kinds of build in
data type :-
1.int type.
2.char type.
3.float type.
4.double type.
5.void type.
10. Void data type
The void data type specifies an
empty set of values .
It is used as the return type for
functions that do not return a
value.
11. Int data type
Integers are whole number such as 5,39,-
1917,0 etc.
they have no fractional part.
Integers can have positive as well as
negative value .
An identifiers declared as int cannot have
fractional part.
12. Each integer comes in two flavors:
1. Signed
2. Unsigned
• Half of the numbers represented by signed short
Are positive and other half are negative.
• All numbers represented by short are non-negative.
• If you know that value stored in a variable is
always negative, declare it as unsigned.
• The size of datatype may vary depending on the
compiler.
13. Char data type
characters can store any member of
the c++ implementation’s basic
character set .
An identifiers declared as char
becomes character variable .
char set is often said to be a integer
type .
14. Float data type
A number having a fractional part is
a floating-point number .
the decimal point shows that it is a
floating-point number not an integer.
for ex-31.0 is a floating-point
number not a integer but simply 31 is
a integer.
15. Double data type
It is used for handling floating-point
numbers.
It occupies twice as memory as float.
It is used when float is too small or
insufficiently precise.
16. Data type modifiers
The basic data type has modifiers
preceding them .we use modifier to alter
the meaning of the base type to fit various
situation more precisely.
There are 3 types of modifiers:-
1.Integer type modifiers.
2.Character type modifiers .
3.Float type modifiers .
17. Integer type modifiers
By using different number of bytes to
store values , c++ offers 3 types of
integers :short , int and long that can
represent upto three different integer
sizes.
A short integer is at least 2 bytes .
A int integer is at least as big as short .
A long integer is at least 4 bytes .
18. TYPE APPROXIMATE
SIZE(IN BYTES)
MINIMAL RANGE
short 2 -32768 to 32767
Unsigned short 2 0 to 65,535
Signed short 2 same as short
Int 2 -32768 to 32767
Unsigned int 2 0 to 65,535
Signed int 2 same as int
Long 4 -2,147,483,648 to
2,147,483,647
Unsigned long 4 0 to 4,294,967,295
19. character type modifiers
The char type can also be signed or
unsigned .
The unsigned char represent the range 0
to 255.
The signed char represent the range -128
to 127.
21. Floating-point type modifiers
C++ has three floating-point types : float
, double and long double.
float type occupies 4 byte.
Double occupies 8 byte .
Long double occupies 10 byte.
23. Derived Data Types
From the built in data types other types
can be derived called derived data types.
There are 5 types of derived data
types :-
1.Arrays.
2.Functions.
3.Pointers.
4.References.
5.Constant.
24. ARRAYS
Values of similar type stored in continuous
memory locations.
int a[10]; char string[3]=“xyz”;
Array can be one dimensional , two
dimensional , multi dimensional.
For ex-float a[3]; //declares array of three
floats :a[0],a[1],a[2].
Int b[2][4]; //declares a 2 dimension array
of integer:b[0][0], b[0][1], b[0][2], b[0][3],
b[1][0], b[1][1], b[1][2], b[1][3].
25. Functions
Set of statements to perform specific
tasks.
A piece of code that perform specific
task.
Introduces modularity in the code.
Reduces the size of program.
C++ has added many new features
to the functions to make them more
reliable and flexible.
It can be overloaded.
27. Pointers
Pointers can be declared and initialized as in
C.
int * ip; // int pointer
ip = &x; // address of x assigned to ip
*ip = 10; // 10 assigned to x through
indirection
28. References
A reference is an alternative name of
an object.
Constant
A constant is a data item whose data value
can never change during the program run.
29. Classes and Objects
Class is a way to bind the data and
procedures that operates on data.
Class declaration:
class class_name
{
private:
variable declarations;//class
function declarations;//members
public:
variable declarations;//class
function declarations;//members
};//Terminates with a semicolon
30. Classes and Objects
Class members that have been declared as
private can be accessed only from within
the class.
Public class members can be accessed
from outside the class also.
Supports data-hiding and data
encapsulation features of OOP.
31. Classes and Objects
Objects are run time instance of a class.
Class is a representation of the object, and
Object is the actual run time entity which
holds data and function that has been
defined in the class.
Object declaration:
class_name obj1;
class_name obj2,obj3;
class class_name
{……}obj1,obj2,obj3;
32. Structures
Structures Revisited
◦ Makes convenient to handle a group of logically
related data items.
struct student //declaration
{
char name[20];
int roll_number;
float total_marks;
};
struct student A;// C declaration
student A; //C++ declaration
A.roll_number=999;
A.total_marks=595.5;
Final_Total=A.total_marks + 5;
33. Structures in C++
Can hold variables and functions as
members.
Can also declare some of its members as
‘private’.
C++ introduces another user-defined type
known as ‘class’ to incorporate all these
extensions.
34. Unions
A union is like a record
◦ But the different fields take up the same space
within memory
union foo {
int i;
float f;
char c[4];
}
Union size is 4 bytes!
35. Operators
• C supports rich set of operators.
• An operator is a symbol that tells the compiler to
perform certain mathematical or logical
manipulations.
• Operators are used in programs to manipulate data
and variables.
37. Unary Operators
• A unary operator is one which operates on one value
or operand. The minus sign (-) plays a dual role, it is
used for subtraction as a binary operator and for
negation as a unary operator. This operator has a
precedence higher than the rest of the arithmetic
operators.
• result = -x * y;
• in the above expression, if x has a value 20 and y has
a value 2, then result will contain a negative value of
40 which is -40.
1/28/2016
43. 2. Relational operator
C supports six Relational Operators
< Is less than
<= Is less than or equal to
> Is greater than
>= Is greater than or equal to
== Is equal to
!= Is not equal to
44. • Suppose that a and b are integer variables whose
values are 100 and 4, respectively. Several arithmetic
expressions involving these variables are shown
below, together with their resulting values.
1/28/2016
a=100, b=4
45. 3.Logical operators
• Logical Operators
– &&, || and ! are the three logical operators.
– expr1 && expr2 has a value 1 if expr1 and expr2 both are
nonzero i.e. if both have values 1(true)
– expr1 || expr2 has a value 1 if either expr1 or expr2 or both
are nonzero i.e 1(true).
– !expr1 has a value 1 if expr1 is zero else 0.
– Example
– if ( marks >= 40 && attendance >= 75 ) grade = ‘P’
– If ( marks < 40 || attendance < 75 ) grade = ‘N’
48. 4. Assignment operators
• Assignment operators are used to assign the result of an expression
to a variable.
• C has a set of ‘shorthand’ assignment operator :
variable name =expression;
Exam - a + = 3;
a = a + 3;
Both are same.
Left side must be an object that
can receive a value
49. Shorthand Assignment operators
Simple assignment
operator
Shorthand operator
a = a+1 a + =1
a = a-1 a - =1
a = a* (m+n) a * = m+n
a = a / (m+n) a / = m+n
a = a %b a %=b
50. 5. Increment and decrement operators.
• Increment Operator ++
a=10;
a++ =10 (post increment but in memory its value is 11)
when you will again call value of a, then a=11
• Decrement Operator --
b=5;
b-- =4 in memory but output will be 5; when you will call b
again then value will be 4.
• Similarly increment and decrement operator is used in
subscripted variables as:
a[ i++]=5;
is equivalent to
a[ i]=5;
i=i+1;
51. 6. Conditional operator
• The conditional expression can be used as shorthand for
some if-else statements. It is a ternary operator.
• This operator consist of two symbols: the question mark
(?) and the colon (:).
for example:
a=11;
b=20;
x=(a>b) ? a : b;
Identifier
Test Expression
Exp 1: Exp 2
52. 7. Bitwise operator
• C supports bitwise operators for manipulation of data at bit
level.
• Bitwise operators may not be applied to float or double.
• Bitwise operators are as follows:
& bitwise AND
| bitwise OR
^ bitwise exclusive OR
<< shift left
>> shift right
~ One’s Complements (bitwise NOT)
53. int a = 205; // In binary: 11001101
int b = 45; // In binary: 00101101
int c = a | b; // In binary: 11101101
println(c); // Prints "237", the decimal equivalent to 11101101
BINARY OR
11001101
00101101
11101101RESULT
OR means any one
input must be true to
get output as true
54. LEFT SHIFT <<
int m = 1 << 3
Output will be 8
_ _ _ 1
_ _ 1 _
_ 1_ _
1 _ _ _
Input
Output: 1000 in binary
So 8 in decimal
1<< 1st bit
1<< 2nd bit
1<< 3rd bit
55. 8. Special operator
• C supports some special operators such as:
comma operator “,”
int a=5,b=6;
size of operator “sizeof()”
Address operator “&”
pointer operator “*”
member selection operator “. and -> ”
56. 8. Special operator
• Scope Resolution Operator
– :: is a scope resolution operator
– Scope resolution operator(::) is used to define a
function outside a class or when we want to use a
global variable but also has a local variable with
same name.
– Why need?
– When local variable and global variable are having
same name, local variable gets the priority. C++
allows flexibility of accessing both the variables
through a scope resolution operator.
58. 8. Special operator
• Scope Resolution Operator
– For example
– Class MyClass
{
int n1, n2;
public:
{
void func1(); //Function Declaration
}
};
public void MyClass::func1()
{
// Function Code
}
Use of Scope Resolution
Operator to write function
definition outside class
definition
59. Precedence of operators
• Precedence establishes the hierarchy of one set of operators
over another when an arithmetic expression has to be
evaluated.
• It refers to the order in which c evaluates operators.
• The evaluation of operators in an arithmetic
expression takes place from left to right for operators having
equal precedence .
60. Precedence of operators
BODMAS RULE-
Brackets of Division Multiplication Addition Subtraction
Brackets will have the highest precedence and have to be evaluated
first, then comes of , then comes division, multiplication, addition
and finally subtraction.
C language uses some rules in evaluating the expressions and they r
called as precedence rules or sometimes also referred to as
hierarchy of operations, with some operators with highest
precedence and some with least.
The 2 distinct priority levels of arithmetic operators in c are-
Highest priority : * / %
Lowest priority : + -
61. Associativity of operators
• Associativity tells how an operator associates with its operands.
for eg:
Associativity means whether an expression like x R y R z
(where R is a operator such as + or <= ) should be evaluated
`left-to-right' i.e. as (x R y) R z or `right-to-left' i.e. as x R (y
R z)
The assignment operator = associates from right to left.
• Hence the expression on the right is evaluated first and its value is
assigned to the variable on the left.
• Associativity also refers to the order in which c evaluates operators in
an expression having same precedence.
• Such type of operator can operate either left to right or vice versa.
• The operator () function call has highest precedence & the comma
operator has lowest precedence
• All unary , conditional & assignment operators associate RIGHT
TO LEFT .
• All other remaining operators associate LEFT TO RIGHT
62. Rules for evaluation of expression
1. First parenthesized sub expression from left to right are
evaluated.
2. If parentheses are nested, the evaluation begins with the
innermost sub expression
3. The precedence rule is applied in determining the order of
application of operators in evaluating sub expressions
4. The associatively rule is applied when 2 or more operators
of the same precedence level appear in a sub expression.
5. Arithmetic expressions are evaluated from left to right using
the rules of precedence
6. When parentheses are used, the expressions within parentheses
assume highest priority
63. Hierarchy of operators
Operator Description Associativity
( ), [ ] Function call, array element
reference
Left to Right
+, -, ++, - -
,!,~,*,&
Unary plus, minus, increment,
decrement, logical negation,
1’s complement, pointer
reference, address
Right to Left
*, / , % Multiplication, division,
modulus
Left to Right
64. Type Casting
• Type casting is a way to convert a variable from one
data type to another data type.
• When variables and constants of different types are
combined in an expression then they are converted
to same data type. The process of converting one
predefined type into another is called type
conversion.
DATATYPE 1 DATATYPE 2
65. Implicit Type Casting
• When the type conversion is performed
automatically by the compiler without programmers
intervention, such type of conversion is known as
implicit type conversion or type promotion.
• For example when you add values having different
data types, both values are first converted to the
same type: when a short int value and an int value
are added together, the short int value is converted
to the int type.
1/28/2016
int + short int int
66. • C does implicit DataType conversion when the need
arises.
• When a floating point value is assigned to an integer
variable, the decimal portion is truncated.
When a value 156.43 is assigned to an integer variable,
156 is stored and the decimal portion is discarded.
If an integer 200 is assigned to a floating point variable,
the value is converted to 200.000000 and stored.
(integer type variable)a= 156.43 156.43
(float type variable) float b = 200 200.000000
1/28/2016
67. Explicit Type Casting
• The type conversion performed by the programmer
by posing the data type of the expression of specific
type is known as explicit type conversion.
• Type casting in c is done in the following form:
(data_type) expression;
where, data_type is any valid c data type, and
expression may be constant, variable or expression.
For example,
x=(int)a+b*d;
68. Example
#include <stdio.h>
main()
{
int sum = 17, count = 5;
double mean;
mean = (double) sum / count;
printf("Value of mean : %fn",
mean );
}
Output is
Value of mean : 3.400000
It should be noted here
that the cast operator has
precedence over division,
so the value of sum is first
converted to type double
and finally it gets divided
by count yielding a double
value.
69. Rules for Implicit Type Casting
The following rules have to be followed while
converting the expression from one type to
another to avoid the loss of information:
• All integer types to be converted to float.
• All float types to be converted to double.
• All character types to be converted to integer.