Click here to Skip to main content
16,004,806 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
please tomorow i have exame i can not understand data structure

if any one have any information and have any book or web side can help me

i can not write any code data structure by c++
Posted

you can write like this:
struct A{
int data;
};
 
Share this answer
 
use google!

A data structure is a group of data.

It allows you to put things together...


imagine a car that can be defined by:

struct car
{
    int number_of_doors;
    int number_of_seats;
    int number_of_mirrors;
    int number_of_brake_lights;
    int colour;
    bool solar_roof;
    bool automatic_transmission;
    string brand;
    string model;
};


Doing hat you've grouped the variables in a "set".

If you would need an array you would be able to access it like:

int j = 0;
for (int i=0,i<max;i++)>
{
  if (array_cars[1].solar_roof)
  {
    j++;
  }
}
printf("%i",j);


This is for sure not the most precise and clear explanation about structures in the world, but at least it is easy to understand.

you can define a type and then use that type as int,bool... so you could declare a new variable named whatever_you_d_like_to to represent a structure of your newly defined type.

Good luck.
 
Share this answer
 
Well, I think you have left it too late, but this[^] may be what you need to look at.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900