Act 31

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

#include <iostream>

#include<string>

using namespace std;

struct Employee {

int empid;

string empfname;

string emplname;

double salary;

string dname;

};

void displayemp (Employee);

int main(){

Employee emp; //structure variable

//assigning values to the structure variable

cout << "Enter employee ID:";

cin >>emp.empid;

cout << " Enter employee first name:";

cin >>emp.empfname;

cout << " Enter employee last name:";


cin >>emp.emplname;

cout << " Enter employee salary:";

cin >>emp.salary;

cout << " Enter the department name:";

cin >>emp.dname;

displayemp(emp);//function calling with parameters

//displaying values

return 0;

void displayemp (Employee emp){


cout << " " << endl <<

" " << endl <<

"Employee ID :" << emp.empid << endl <<

" " << endl <<

"Employee full name is:" <<emp.empfname <<" "<<emp.emplname


<< endl <<

" " << endl <<

"Employee salary:" <<emp.salary << endl <<

" " << endl <<

"Employee department name:" <<emp.dname << endl;

You might also like