define type c++

#include <iostream>

// Define a custom data type named 'Person' using struct
struct Person {
    // Member variables
    std::string name;
    int age;

    // Member functions (methods)
    void displayInfo() {
        std::cout << "Name: " << name << ", Age: " << age << std::endl;
    }
};

int main() {
    // Declare an instance of the 'Person' type
    Person person1;

    // Assign values to the member variables
    person1.name = "John";
    person1.age = 25;

    // Call a method of the 'Person' type to display information
    person1.displayInfo();

    return 0;
}