declare a structer in cpp

A structure in C++ can be declared using the struct keyword. Here is an example of how to declare a structure in C++:

struct Person {
    std::string name;
    int age;
    float height;
};

In this example, we have declared a structure named Person. The structure contains three members: name, age, and height. Each member is separated by a semicolon (;).

The name member is of type std::string, which is a C++ class for handling strings. It represents the name of the person.

The age member is of type int, which represents the age of the person.

The height member is of type float, which represents the height of the person.

By declaring a structure, we are creating a new data type that can hold multiple values of different types. We can then use this structure to create variables and store data related to a person, such as their name, age, and height.

Structures in C++ are often used to organize related data and create user-defined data types. They provide a way to group together different variables that are logically related to each other.