lab 3 OOP Preston Uni
lab 3 OOP Preston Uni
Submitted to:
Lab # 3
Section: BSCE(E
)
Submission Date : 12/22/2023
LAB #3
STRUCTURES
Program No#1:
Write C++ programs to do the (Date: Moth, Day, Year) [5] 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/2020, store it in a variable of type
struct date, then retrieve the values from the variable and print them out in the same format.
Program No#2:
2. (Census) [ANSI C] [8] Define a structure named census with the following three members:
A character array city[] to store names
A long integer to store population of the city
A float member to store the literacy level (e.g., 90% means 0.9 in float)
Write a program to do the following:
To read details for cities using an array variable
To sort the list alphabetically
Program No#3:
Define a structure called cricket that will describe the following information: 3. (Cricket team) [8] Player name Team
name Batting average Using cricket, declare an array player with 50 elements and write a program to read the
information about all the 10 players and print a team-wise list containing names of players with their batting
average. using c++ code
Program No#4:
Movie Data [7] Write a program that uses a structure named MovieData to store the following information about a
movie: Title using C++ language Director Year Released Running Time (in minutes). The program should create two
MovieData variables, store values in their members, and display the information about the movie in a clearly
formatted manner.
Program No#5:
Customer Accounts [7] Write a program that uses a structure named to store the following Data about a customer
account:
Name
Address
City, State, and ZIP
Telephone Number
Account Balance
Date of Last Payment
The program should use an array of at least 20 structures. It should let the user enter data into the array, change the
contents of any element, and display all the data stored in the array. The program should have a menu-driven user
interface.
Input Validation: When the data for a new account is entered, be sure the user enters data for all fields. No negative
account balances should be entered.