C++ Program using a structure

In this program, You will learn how to implement structure in C++.

struct struct_name { 
      //variable declaration

Example: How to implement structure in C++

using namespace std;

struct Test {
    int x, y;

int main() {

    struct Test t;

    t.x = 10;
    t.y = 20;

    cout << "x value is:" << t.x;
    cout << "\ny value is:" << t.y;

    return 0;


x value is:10
y value is:20