here your below program:
#include <iostream>
using namespace std;
struct Persondetails
{
char firstname[50];
char lastname[50];
int age;
float salary;
};
int main()
{
Persondetails p1;
cout << “Enter first name: “;
cin>>p1.firstname;
cout << “Enter last name: “;
cin>>p1.lastname;
cout << “Enter age: “;
cin >> p1.age;
cout << “Enter salary: “;
cin >> p1.salary;
cout << “nDisplaying Information.” << endl;
cout << “Name: ” << p1.firstname << endl;
cout << “Name: ” << p1.lastname << endl;
cout <<“Age: ” << p1.age << endl;
cout << “Salary: ” << p1.salary;
return 0;
}
OUTPUT:
Enter first name: hemanth
Enter last name: kumar
Enter age: 90
Enter salary: 789
Displaying Information.
Name: hemanth
Name: kumar
Age: 90
Salary: 789