Lab 07: Structure Arrays and File Processing Part-I
Posted by Fawad Ishaq on July 4, 2008
| Ask an Expert | Live Programming Help |
Instructions
- You must have installed Microsoft Visual Studio 6.0/Microsoft Visual Studio .NET 2003/Microsoft Visual Studio .NET 2005 on your machine to try the programs.
- To develop the C++ program on Microsoft Visual Studio 6.0 please read the handout “How to create your first C++ program using Visual C++ 6.0”.
- To develop the C++ program on Microsoft Visual Studio .NET 2003 please read the handout How to create your first C++ program using Visual C++ .NET 2003.
- To develop the C++ program on Microsoft Visual Studio .NET 2005 please read the handout How to create your first C++ program using Visual C++ .NET 2005.
Exercise 01
1. Define a structure Employee consisting of following data members:
• Employee code (use integer type variable to store the employee code)
• Employee name (use char array of 50 elements to store the employee name)
• Department Code (use integer type variable to store the department code)
• Department name (use char array of 50 elements to store the department name)
• Salary (use double type variable to store the employee salary)
2. Declare an array of Employee type consisting of 5 elements. Use constant variable to declare an array.
3. The program should allow the user to enter the data of five employees from the console.
4. Save the data of five employees in Employee.dat file.
5. Create a separate program that should only write the data to an output file.
Exercise 02
1. Define a structure Employee having following data members:
• Employee code (use integer type variable to store the employee code)
• Employee name (use char array of 50 elements to store the employee name)
• Department Code (use integer type variable to store the department code)
• Department name (use char array of 50 elements to store the department name)
• Salary (use double type variable to store the employee salary)
2. Declare an array of Employee type consisting of 5 elements. Use constant variable to declare an array.
3. Read the data of five employee from a Employee.dat file (created in exercise 01) and store in an array of type Employee.
4. Print the data of five employees on the console.
5. Create a separate program that should only read the data from a file and print it.
How to submit?
1. Submit your assignments to Mr. Adeel as per the schedule announced by him.
2. No assignment shall be evaluated/accepted after the due date.
3. Copy assignments will be cancelled.
4. There will be an individual viva of this assignment. Your evaluation is strictly based on your performance in the viva.
5. Non-professional behavior during the viva may lead to assignment cancellation.

