How we write a C/C++ program which creates a Structure named Employee. Your program should ask the user about the number of Employee Records he/she want to enter. After taking input from the user our program should dynamically allocate the memory for the number of Employee Records entered.
Our Program should fulfill the following criteria
•Save each Employee record in a file.
Our Structure of Employee Record should have the following attributes.
1: Employee ID.
2: Employee Name.
3: Pay.
In your code you should use
•File handling mechanism,
oOpen/create a file.
oWrite/append data to the opened file.
oRead Records from the file.
oClose the file.
The following menu of commands should be displayed at the start of our program execution.
Press 'A' or ‘a’ to Add Records
Press 'D' or ‘d’ to Display All Records
Press 'Q' or ‘q’ to Quit
Please enter your choice:a
For example, if the user presses ‘A’ or ‘a’ then our output should be similar to:
Enter the number of Records you want to enter : 2
Enter Employee ID# 123
Enter Employee Name Ali
Enter Pay 6000
Enter Employee ID# 345
Enter Employee Name Ahmed
Enter Pay 7000
if the user presses ‘D’ or ‘d’ then ouroutput should be similar to:
Employee ID# 123
Employee Name Ali
Pay 6000
Employee ID# 345
Employee Name Ahmed
Pay 7000
How we write a C/C++ program which creates a Structure named Employee. our program should ask the user about t
I had this exact same assignment.
const short kMaxNameSize = 20;
struct Employee
{
char name[ kMaxNameSize ];
long id;
float salary;
};
That creates a structure named employee. I'll just mention though you will get a great deal more self-satisfaction if you work something out on your own without getting other people to do all of the work for you.
Reply:Please post the code you have written so far so we can help you with it.
If we just do your homework for you and you hand it in and get caught you'll be in deep trouble. If we help you with your work, but it's still your work, then you'll be Ok and we don't want to get you in trouble.
///
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment