0% found this document useful (0 votes)
3 views

structure

The document is a C++ program that defines a structure for student details, including first name, last name, age, and status. It creates two student instances with specific attributes and prints their details to the console. The program demonstrates basic struct usage and output in C++.

Uploaded by

Sajid Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

structure

The document is a C++ program that defines a structure for student details, including first name, last name, age, and status. It creates two student instances with specific attributes and prints their details to the console. The program demonstrates basic struct usage and output in C++.

Uploaded by

Sajid Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <iostream>

using namespace std;


struct student_detail
{
string firstname;
string lastname;
string status;
int age = 0;
};

int main()
{

student_detail student_1;
student_detail student_2;

student_1.firstname = "Sajid";
student_1.lastname = "Ali";
student_1.age = 21;
student_1.status = "Alive";

student_2.firstname = "Muhammad";
student_2.lastname = "Ali";
student_2.age = 81;
student_2.status = "Deceased";
cout << "Student 1:"<<endl;
cout << "First Name " << student_1.firstname << endl;
cout << "Last Name " << student_1.lastname << endl;
cout << "Age: " << student_1.age << endl;
cout << "Status " << student_1.status << endl;
cout << endl;
cout << "Student 2:"<<endl;
cout << "First Name " << student_2.firstname << endl;
cout << "Last Name " << student_2.lastname << endl;
cout << "Age: " << student_2.age << endl;
cout << "Status " << student_2.status << endl;
return 0;
}

You might also like