Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

Data Handling

Loading...

Published in: Big Data & Hadoop
2,892 Views

This ppt is based on chapter 7 Data handling in C++. In short i have explained the whole topic that will be helpful in last minute revision.

Tritesh P / Navi Mumbai

4 years of teaching experience

Qualification: M.Sc

Teaches: Computer Science

Contact this Tutor
  1. Chaptgr:-7 BaseTech Technology & Academy Data Handling 7.7 7.2 7.3 7.3.1 7.3.2 7.3.3 7.3.q 7.4 7.3.1 7.3.2 7.3.3 7.3.q 7.q.5 .5 introduction Concept of Data Types C++ Data Types Fundamental of Data Types Data Type Modifiers Derived Data Types User Defined Derived Data Types Variables Declaration of a Variable injtjaljzatjon of Variables Dynamic injtjaljzatjon The Access Modjfjer Const References Formatting OUtPUt
  2. Introduction: o C++ provides a predefined set of data types for handling the data it uses. o The data types can either be fundamental or derived. o The derived data types in C++ come in 2 groups : built, in types & user-defined types. o Data can be stored in any of these data types.
  3. Concept of Data Types o Data can be of many types e.g., character , integer , real , string etc. o Anything enclosed in single quotes represents character data in C++. o Numbers without fractions represents integer data. o Numbers with fractions represents real data. o Anything enclosed in double quotes represents a string. o There are 5 fundamental types in C++ : char , int , float , double and void.
  4. Data Type Modifiers : o Modifier are used to alter the meaning of the base type to fit various situations more precisely. o List of modifiers is given below: signed unsigned long short
  5. Integer Type Modifiers : o By using different number of bytes to store values, C++ offers three types of integers : short , int , and long that can represent up to three different sizes. o The prefix unsigned makes the integer type not to hold negative values. o Unsigned types are used for quantities that are never negative such as populations , etc.
  6. Character Type Modifiers : o The char type is really another integer type(as inside memory it actually holds numbers i.e., equivalent codes of character/symbols). o A single byte can represent the whole range of 256 known characters.
  7. Floating Type Modifiers : o C++ has three floating, point types : float , double , long double. o Float occupies 4 bytes. o Double occupies 8 bytes.
  8. Derived Data Types . o The derived types in C++ : Arrays Functions Pointers References Constants
  9. Arrays . An array is an identifier to store a set of data with common name. (or) An array is a collection of similar elements in a continuous manner. Note that a variable can store only a single data. Arrays may be one dimensional or multi dimensional. For example : int a[4] , int
  10. Functions : Functions are programs . There are two types of functions C2Library functions and CIUser•defined function. The advantage of function : 1) A large program can be broken into a number of smaller modules.
  11. Example : #include #include void main() void msg(); clrscr(); msg(); getch(); void msg() / / local declaration cout
  12. Pointers : A pointer is a variable that holds a memory address. This address is usually the location of another variable in memory. If one variable contains the address of another variable, the first variable is said to point to the second. For example : int *p;
  13. References . A reference is an alternative name for an object. A reference variable provides an alias for a previously defined variable. A reference declaration consists of a base type , an &(ampersand), a reference variable name equated to a variable name(previously defined).
  14. Constants : The keyword const can be added to the declaration of an object to make that object a constant rather than a variable. The general form of constant declaration is : const type name = value ;
  15. User Defined Derived Data Types a Class a Structure aUnion a Enumeration
  16. Structure : A structure is a collection of variables referenced under one name , providing a convenient means of keeping related information together. For example , struct student { int rollno; char name[20]; float marks;
  17. Union : Union is a concept similar to a structure with the major difference in terms of storage. In the case of structures each member has its own storage location, but a union may contain many members of different types but can handle only one at a time.
  18. For example , union var { int m; char n[10]; float c; Union varx ; Now x is a union containing three members m ,n , c. But only one value can be stored either in x.m , x.n or x.a
  19. Variables : Variables represent named storage locations, whose values can be manipulated during program run. Memory add Data Value of variable variable's names 1051 1052 10 1053 1054 1055 25
  20. Declaration of a variable : Int age ; To declare a signedlunsigned variable , place these modifiers before the datatype. Signed int value; Unsigned short count; Signed long gross;
  21. Initialization of variable : A first value (initial value)may be specified in the definition of a variable. A variable with a declared first value is said to be an initialised variable. int val =1000; int val(1000); int val = int(1000);
  22. Dynamic variable : One additional feature of C++ is that it permits initialization of the variable at run time This is referred to as dynamic initialization. Example , float avg; Avg = sum/count;
  23. The Access Modifier Const : Const keyword lets you create constants. It is readable only, it can no more be written on to. Example , const int val = 10
  24. References : A reference is an alternative name for an object. A reference variable provides an alias for a previously defined variable. The general form of declaring a reference variable is type &ref-var = var-name; Example , if sum is declared as a reference variable for a variable for a variable total , then both sum and total represent the same variable and can be used interchangeably. int total ; int &sum = total; total = 100; Cout