<< Chapter < Page | Chapter >> Page > |
5) A prime integer is any integer that is evenly divisible only by itself and 1. The Sieve of Eratosthenes is a method of finding prime numbers. It operates as follows:
When this process is complete, the array elements that are still set to one indicate that the subscript is a prime number. These subscripts can then be printed.
Write and run a C++ program that uses an array of 1000 elements to determine and print the prime numbers between 1 and 999. Ignore element 0 of the array.
6) The Colossus Airlines fleet consists of one plane with a seating capacity of 12. It makes one flight daily. Write a seating reservation program with the following features:
a. The program uses an array of 12 structures. Each structure should hold a seat identification number, a marker that indicates whether the seat is assigned and the name of the seat holder. Assume that the name of a customer is not more than 20 characters long.
b. The program displays the following menu:
c. The program successfully executes the promises of its menu. Choices (4) and (5) need additional input from the user, which is done inside the respective functions.
d. After executing a particular function, the program shows the menu again, except for choice (6).
7) In this problem, a customer calls in an order for bicycles, giving his or her name, address, number of bicycles desired, and the kind of bicycle. For now, all bicycles on one order must be the same kind. Mountain bikes cost $269.95 each and street bikes $149.50. The total bill is to be calculated for the order. Additionally, based on the user’s knowledge of the customer, the customer is classified as either a good or bad credit risk. Based on the input data, the program is to prepare shipping instructions listing the customer’s name, address, number and type of bikes, and the total amount due. Based on the creditworthiness of the customer, the program must indicate on the shipping instructions if this is a C.O.D. (cash on delivery) shipment or whether the customer will be billed separately.
The input and output requirements of this problem are relatively simple. On the input side, the items that must be obtained are:
Notification Switch
Would you like to follow the 'Programming fundamentals in c++' conversation and receive update notifications?