Answer to Question #270131 in C++ for Moh

Question #270131

Write a c++ program segment to assign data to members of a structure called employee having name ,age and salary then display it.


1
Expert's answer
2021-11-22T15:17:25-0500




int main() {
	//declare a variable of type Employee as
    EMPLOYEE  emp;
    
    //propmt the user to enter the employee details 
    //i.e name, age, salary and store them in corresponding
	// fields of structure variable
    cout << "Enter name of employee : ";
    cin.getline(emp.employee_name, 50);
    cout << "Enter employee age : ";
    cin >> emp.employee_age;
    cout << "Enter salary of employee : ";
    cin >> emp.employee_salary;
   
    
    // Printing employee details 
    cout << "\n*** Employee Details ***" << endl;
    cout << "Employee Name : " << emp.employee_name << endl;
    cout << "Employee age : " << emp.employee_age<<endl;
	cout<< "Employee Salary : " << emp.employee_salary << endl;
    
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS