+ All Categories
Home > Documents > CHAPTER 7 DATA HANDALING

CHAPTER 7 DATA HANDALING

Date post: 04-Jan-2016
Category:
Upload: gefen
View: 47 times
Download: 0 times
Share this document with a friend
Description:
CHAPTER 7 DATA HANDALING. Prepared By : VINAY ALEXANDER (विनय अलेक्सजेंड़र) PGT(CS) ,KV JHAGRAKHAND. DATA TYPE :- T o identify the data & associated operation of handling it. There are 2 type of data types in c++ 1.Fundamental data type 2.Derived data type. - PowerPoint PPT Presentation
40
CHAPTER 7 CHAPTER 7 DATA HANDALING DATA HANDALING Prepared By Prepared By : VINAY ALEXANDER VINAY ALEXANDER ( ( वववव वववव ववववववववववव ववववववववववव ) ) PGT(CS) ,KV JHAGRAKHAND PGT(CS) ,KV JHAGRAKHAND
Transcript
  • CHAPTER 7DATA HANDALINGPrepared By :VINAY ALEXANDER ( )PGT(CS) ,KV JHAGRAKHAND

  • DATA TYPE:- To identify the data & associated operation of handling it. There are 2 type of data types in c++ 1.Fundamental data type 2.Derived data type

  • 1)FUNDAMENTAL TYPES IT IS THOSE THAT ARE NOT COMPOSED OF OTHER DATA TYPE(2)DEIVED TYPES-IT IS THOSE THAT ARE CONSTRUCATED FROM THE FUNDAMENTAL TYPE.

  • IT ALTER THE MEANING OF THE BASE TYPE TO FIT VARIOUS SITUATION MORE PRECISELYTHE LIST OF MODIFIRES ARE-SIGNED: Number starting with negative to positiveUNSIGNED: All are positive valueLONGSHORT

  • TYPEAPPROXIMATE SIZE(IN BYTES)MINIMAL RANGESHORT2-32768 TO 32767UNSINGED SHORT20 TO 65,535SINGED SHORT2SAME AS SHORTINT2-32768 TO 32767UNSIGNED INT20 TO 65,535SINGED INT2SAME AS INTLONG4-2,147,483,648 TO 2,147,483,647UNSIGNED LONG40 TO 4,294 967 295SIGNED LONG4SAME AS LONG

  • TYPEAPPROXIMATE SIZE(IN BYTES)MINIMAL RANGECHAR1-128 TO 127UNSINGED CHAR10 TO 255SINGRD CHAR1SAME AS CHAR

  • TYPEAPPROXIMATE SIZE(IN BYTE)MINIMAL RAGEDIGIT OF PRECISIONFLOAT43.4*10-38 TO 3.410-38-17DOUBLE81.7*10-308 TO 1.7*10-308-115LONG DOUBLE103.4*10-4932 TO 1.1 10-4932-119

  • FUNCTION: It is a collection of statement that perform a specific tasks and return a value. Example:/* w.a.p(using function) to accept a number and print its cube. */ #include #include float cube(float); int main() { clrscr(); float num; coutnum; cout
  • EXAMPLE FOR POINTER:int X = 547;int *ptr;ptr=X;HERE:Veriable nameContentsLocationX 5474000 ptr 4000 4036According to above figure, By the help of ptr variable we stored the address of variable X in address 4036

  • A union is like a structure in which all members are stored at the same address. Members of a union can only be accessed one at a time. The union data type was invented to prevent memory fragmentation. The union data type prevents fragmentation by creating a standard size for certain data. Just like with structures, the members of unions can be accessed with the . and -> operators.

  • Variables: Variables are locations in memory in which values can be stored. Each one has a name ,a type , and a value.=> There are two values associated with a symbolic variable:1.rvalue(are-value):Its data value , stored at some location in memory.2.lvaue(el-value): its location value , that is , the address in memory at which its value is stored.

  • int A=10,C=25; 1051 1052 1053 1054 1055

    A CMemoryAddress

    Data value of Variable

    Variable's name

    1025

    rvalue of A=10lvalue of B=1052rvalue of C=25lvalue of C=1055

  • =>Declaring Variables: Variable declaration consist of a type and a variable name:Example:int age,x; // declares age and x of integer typeNote:1. Variable names in C++ can start with a letter or an underscore( _ ).2. They cannot start with a number. After the first character. your variable names can include any letter or number.=> Incorrect variable names 1. 6abc2. /abc=> correct variable names 1. ABC2. _6abc

  • Initialization of variables: Variables are initialized (assigned an value) with an equal sign followed by a constant expression. The general form of initialization is:=>variable name = value; Variables can be initialized (assigned an initial value) in their declaration. The initializer consists of an equal sign followed by a constant expression as follows:=>type variable name = value;

  • Example:- int y; y=10;int y=10;int y(10);

    For declarations without an initializer: variables with static storage duration are implicitly initialized with NULL (all bytes have the value 0); the initial value of all other variables is undefined.

  • =>Dynamic Initialization: A variable can be initialized at run time using expression at the place of declaration.Example:float avg,sum;int count;avg =sum/count; // Dynamic Initialization=>The Access Modifier Const: The const keyword create constant. The access of the constant variable is readable only.Example:int val=10;// its value can be changed in the program at any time. const int total=100; //it value can never be changed during program run.

  • => Formatting OUTPUT: It is used to set the output screens. There are two type of I/O manipulator.1. setw( )2.setprecision( ).Above two I/O manipulator include in header file iostream.h1.setw( ): The setw( ) manipulator sets the width of the field assigned for the output.It takes the size of the field(in number of character) as a parameter . By default, values are right-justified in the space provided. We can change this. For example:cout
  • =>Setprecision( ):The setprecision manipulator sets the total number of digits to be displayed when floating point numbers are printed.Example:cout
  • => Additional IOS flags:cout.setf(ios::fixed);fixedi.e., ios::fixed is referred to as a format option. Other option are following:1.left-> left justify the output.2.right-> right justify the output.3.howpoint-> display decimal point and trailing zeros for all floating point number.4.uppercase-> display the e in E notation as E rather than e.5.showpos-> display a leading plus sign before positive values.6.scientific-> Display floating point number in scientific (E) notation.7.fixed->display floating point number in normal notation.-no trailing zeroes and no scientific notation

  • *


Recommended