Can someone help me with this? Every time I run the code, it does not display the whole information that is needed. It always has an error at the last information that I type.
I think the error is here:
cout << "Address:";
cin.getline(e.address, 50);
#include <iostream>
using namespace std;
struct Employee {
char name[50];
int salary;
int employmentStatus;
char Gender[6];
int Age;
char address[50];
};
int main() {
Employee e;
cout << "Full Name: " ;
cin.getline(e.name, 50);
cout << "Age : ";
cin >> e.Age;
cout << "Gender : ";
cin >> e.Gender;
cout << "Address: ";
cin.getline(e.address, 50);
cout << "Salary: ";
cin >> e.salary;
cout << "Employment Status: ";
cin >> e.employmentStatus;
// Printing employee details
cout << "\n*** Employee Details ***" << endl;
cout << "Name : " << e.name << endl << "Salary : " << e.salary << endl << "Age:" << e.Age << endl << "Gender:" << e.Gender << endl;
cout << "Employment Status: " << e.employmentStatus << endl << "Address : " << e.address;
return 0;
}