Write a c++ program to randomly generate


Write a C++ program to randomly generate, store, sort, search and display the car price owned by N students at DWU. N should be declared as a constant in your program and it should be equal to the largest digit of your student id number. Assume N=3, if the largest digit of your student id number is less than 3. You must use a single dimension array to store the car price. Your program should display and execute a menu with the following options. A switch statement must be used to execute the following menu options.

  • 1. Initialise all the elements of the array to -99
  • 2. Randomly generate and store the car price for N students
  • 3. Calculate and display the average price of the car owned by N students
  • 4. Find and display the most expensive car
  • 5. Find and display all cars below the average car price
  • 6. Sort and display all car prices in ascending order
  • 7. Search and display array index for a given car price
  • 8. Exit

The program should display the message "Thanks for using this program", your id number and exit.
The whole program should work in a loop to enable the user to initialise all the elements of the array to
-99, randomly generate and store the car price for N students, calculate and display the average price of
the car owned by N students, find and display the most expensive car, find and display all cars below the
average car price, sort and display all car prices in ascending order, search and display array index for a
given car price and exit.

Request for Solution File

Ask an Expert for Answer!!
Other Subject: Write a c++ program to randomly generate
Reference No:- TGS0117381

Expected delivery within 24 Hours