Answer:
#include<iostream>
using namespace std;
struct student {
string name;
int id;
float gpa;
int major;
};
int main() {
student student1;
student1.name="Patil";
student1.id=1;
student1.gpa=9.80;
student1.major=123;
cout<<"First student last name: "<<student1.name;
}
Step-by-step explanation:
A struct is a container or data structure in C and C++ that holds data that describes or represents an object. It is defined with the struct keyword. Just like a class constructor method, the struct is called with the struct name and the instance name of the struct.
The student struct above is used to create an instance of students registered in a school. The first student struct instance is the 'student1'.