CSCI251 Lab2-Working with Arrays and Structures Solved

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (2 votes)

Following completion of this task, students should be able to:

  • Write C++ programs using arrays and structures § Write programs with output formatting.

Question 1 (Working with Arrays)

Write a program that keeps the exam marks for 20 students in an array of doubles.  The marks should be read from the user.  Invalid marks should not be accepted (marks should be 1 to 100).  The program should include functions to calculate and return the following:

  1. The lowest mark and the highest mark
  2. The average marks
  3. The percentage of students who passed (marks above or equal 50)

The program should then display all the calculated values.

Question 2 (Structures)

Write a program that declares a structure named Event to store the following information about an event:

  • Event id
  • Event type (e.g. Birthday, Wedding, Meeting, etc)
  • Location of the event
  • Date of the event (consists of day, month, and year – declared as a separate structure)
  • Time of the event (consists of hour, minute, and second – declared as a separate structure)

 

Your program should read several event records from the user into an array of structure Event.  Then display all the events in a tabular format.

The following shows an example display for the events entered:

 

Event records:

 

Event ID

 

Event Type         Location

Date of Event Time of Event
————- —————-    ——————————— ——————— ——————
W1001 Wedding             Concorde Hotel Ballroom 25/8/2012 18:30:00
B1003 Birthday             McDonalds 3/9/2012 13:00:00
G1005 Grand Opening Tina Florist 10/8/2012 10:30:00
…

 

…                       … … …

 

 

  • CSCI251_LabTask2-uygi6c.zip