Display the following Employee information using the variables.
Name
Age
Gender
Address
Contact No.
Monthly Salary
#include <iostream>
using namespace std;
typedef struct{
string name;
int age;
string gender;
string address;
string contactNo;
string email;
double monthlySalary;
}Employee;
void printEmployee(Employee e) {
cout << "Name : "<< e.name << endl;
cout << "Age : "<< e.age << endl;
cout << "Gender : "<< e.gender << endl;
cout << "Address : "<< e.address << endl;
cout << "Contact No: " << e.contactNo << endl;
cout << "Email : "<< e.email << endl;
cout << "Monthly Salary : $"<< e.monthlySalary << endl << endl;
}
int main()
{
Employee e1 = { "John Silver", 40, "male", "Springfield Quay, Glasgow G5 8NP, GB", "+441412769599", "silver@org.uk", 5000.00 };
Employee e2 = { "Otto von Bismarck", 50, "male", "Albrechtstrasse, 20, 10117 Berlin, Germany", "+493027907300", "bis@allhotels-inn.com", 3950.00 };
Employee e3 = { "Marie-Antoinette", 21, "female ", "Rue de Rivoli, 75001 Paris, France", "+33140205050", "mary@louvre.fr", 4122.00 };
Employee e4 = { "Nikolai Romanov", 35, "male", "2 Dvortsovaya pl., St. Petersburg, 190000, Russia", "+78127109079", "nik@mail.ru", 4000.00 };
printEmployee(e1);
printEmployee(e2);
printEmployee(e3);
printEmployee(e4);
}
Comments
Leave a comment