Lab 2 Struct
Lab 2 Struct
Lab 2 Structures
Question:
A phone number, such as (212) 767-8900, can be thought of as having three parts: the area code
(212), the exchange (767), and the number (8900). Write a program that uses a structure to store
these three parts of a phone number separately. Call the structure phone. Create two structure
variables of type phone. Initialize one, and have the user input a number for the other one. Then
display both numbers. The interchange might look like this:
Enter your area code, exchange, and number: 415 555 1212
My number is (212) 767-8900
Your number is (415) 555-1212
Question:
Create a structure of type date that contains three members: the month, the day of the month, and
the year, all of type int. (Or use day-month-year order if you prefer.) Have the user enter a date in
the format 12/31/2001, store it in a variable of type struct date, then retrieve the values from the
variable and print them out in the same format.
Question:
- Create a structure called Employee that contains three data members: Name, salary, and
ID. The salary can be defined as a structure that contains five data members:
basic_salary, deductions, bonuses, tax, and net_salary.
- Your program should ask the user to enter the information of three employees.
- Your program should print the employees’ information as the following: