Comments

Monday, October 8, 2012

Using structure Dispaly data IN proer Manner

Posted by at 2:36 PM Read our previous post


Create a structure to hold ENo, EName, Designation and salary of an employee. Take input in this structure variable and
display output.



Source Code
#include <iostream>
#include <string>
using namespace std;
struct Employee
{
                int Eno;
                char Designation[15];
                long salary;
};
void main()
 {
                 Employee Emp;
                 cout << "Enter Employee number: ";
                 cin >> Emp.Eno;
                 cout << endl;
                 cout << "Enter Employee's designation: ";
                 cin >>Emp.Designation;
                 cout << endl;
                 cout << "Enter Employee's salary: " ;
                 cin >> Emp.salary;
                 cout << endl;
                 cout << endl;
                 cout << "Employee Number" << "\t" << " Employee Designation" << "\t" << " Employee Salary" << endl;  cout << endl;
                 cout << Emp.Eno << "\t\t\t" << Emp.Designation << "\t\t\t" << Emp.salary << endl; cout << endl;
 }


Output

 
 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template