Data Structures

Today i will tell about data structure ………..what is data structure ,how many types of data structures and how to use data structure in different situations or for different purpose.  Now what is data structure….? Data structure is actually a way we used to store our data and manage our data. Every data structure is designed for storing and organizing the data in appropriate way.  We can also say that data structure is a container we use to put our data for specific or general purpose.The basic and very simple data structure is “int” as i already had described that C++ is case sensitive language so make sure while writing what you have written so  “int”  int is basic and simple data structure which is used to store the integer values like (1,2,3,4,) say numbers .int takes different size in memory (4 bytes, 8 bytes etc) .In most of compilers it take 4 byte and it ranges from  (-2,147,483,648 to 2,147,483,647).The another is “char”  char is also basic and simple data structure that is used to store the character vales like (a,b,c……..) .It take 1 byte in memory and can store only single character.The next simple one if “float”  float is used to store the values that are in points like (1421.48,    454.544 ,     4854.88….etc).Its range is (-3.4E+38 to +3.4E+38). Now there below i will use one of above data structure that is “int”  i will use this to store   numeric value and then display it.

So here is the code

Line 1 is #include<iostream.h> This is the header file that contains the information of cin>> and cout<<.

Line 2 is #include<conio.h>  This is also a header file that contains the information of clrscr();,  getch();.

Li8ne 4 is void main()  From where the actual code or program starts.

Line 5 is {   This is open curly bracket

Line 6 is  clrscr(); Which will clear the previous screen.

Line 7 is  int num;   Which is the declaration of data structure of name num.

Line  8 is cout<<“Enter number :”;   This will print on screen what is written in double quotes .

Line 9 is cin>>num;   This will take input form user and will store that value in num.

Line 10 is cout<<“you typed”<<num;  This will print on screen what you have typed above.

Line 11 is getch();  This will use to watch the output.

Line 12 is }  This is close curly bracket which means the and of program.


Leave a Reply

Your email address will not be published. Required fields are marked *