编程辅导 C C++ Java Python MIPS Processing 网络家教 在线辅导

编程家教 远程写代码 Debug 讲解答疑 课后答疑 不是中介,本人直接答疑

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

 Write a program to process a collection of daily high temperatures. Your program should count and print the number of “hot days” (temperatures of 25ºC or higher), the number of

 

Write a program to process a collection of daily high temperatures. Your program should count and print the number of “hot days” (temperatures of 25ºC or higher), the number of “pleasant days” (temperatures 16ºC - 24ºC), and the number of “cold days” (temperatures of less than 16ºC). It should also display the category of each temperature. Test your program on the following data:

16, 23, 22, 28, 31, 5, 19, 23, -5, 26, 27, 9, 12, 14, 34, 12, 15, 32, 28, 24, 12, -3, 19, 26, 34, 12

(Hint: declare and initialise an array with these numbers at the beginning of the program)

Also, modify your program to display the average temperature (a real number) at the end of the run.

Do not forget to produce the design document for this exercise!

 

Write a program that initialises an array of double and then copies the contents of the array into two other arrays. Declare all arrays in the main program.

To make the first copy, make a function, which uses the array notation (the square brackets []) to access the elements of the array.

To make the second copy, write a function that uses the pointer notation and pointer incrementing to access the elements of the arrays. 

Have each function take as function arguments the name of the target array and the number of elements to be copied.

Here is an example showing how the functions should be called, given the following declarations:

double source[4] = {1,2.3,4.5,6.7};

double destination1[4];

double destination2[4];

copy_array(source, destination, 4);

Write a program that declares a 3 by 5 two-dimensional array and initialises it with some values of your choice. The program should:

  1. print all the values,
  2. double the values
  3. print again all the values

Write a function that is responsible for displaying the values and a second function that doubles the values. The functions could take as arguments the array name and the number of rows as arguments.

 

Exercise

EdgeLane Airlines has a fleet of one plane with a seating capacity of 14 arranged as 7 rows (1 to 7) of two seats (A and B) (i.e. the seat identification labels are 1A, 1B, …). It makes one flight a day. Write a seating reservation program with the following features:

  1. The program uses an array of 14 structures. Each structure should hold a seat identification label, a flag that indicates whether the seat is assigned, the last name of the seat holder (max 20 characters), and the first name of the seat holder (max 20 characters).
  2. The program displays the following menu:

To choose a function, enter its letter label:

a) Show assigned seats with passenger names.

b) Show list of empty seats.

c) Assign a customer to a seat.

d) Edit customer details, for a specific seat.

e) Delete a seat assignment.

f) Quit.

After executing a particular function the program should show the menu again except for choice (f)

  1. The program should save the data in a file between runs and load the data (if any) at the start of the program.

 

 

相关推荐