Introduction To Computer Programming (ICP) : Lecture-7: Data Types
Introduction To Computer Programming (ICP) : Lecture-7: Data Types
• Data Types
• Different types of Data Types
Data Types
• There are many different types of data
• Variable are classified according to their data types.
• Which determines the kind of information that may be
stored in them.
1A-
4
Integer Data Types
• Integer variables can hold whole numbers such as 12,
7, and -99.
Defining Variables
'A'
Character Literals in Program 2-13
Character Strings
H e l l o \0
The C++ string Class
The C++ string Class
• Special data type supports working with strings
• #include <string>
• Can define string variables in programs:
string firstName, lastName;
• Can receive values with assignment operator:
firstName = "George";
lastName = "Washington";
• Can be displayed via cout
cout << firstName << " " << lastName;
The string class in Program 2-15
Floating-Point Data Types
Floating-Point Data Types