Question: Question 1 Question 2 Question 3 C++ ASAP Ignore question that have syntax error need urgently Question 1 Looping is repeating the same statement several
Question 1
Question 2
Question 3
C++ ASAP Ignore question that have syntax error need urgently
Question 1 Looping is repeating the same statement several times while conditions are still met, which is true. (a) Write the C++ program segment to convert from kilograms to pound starting from 1 to 100 as in Figure 1. Your output should list all the odd numbers in kilogram and convert into pound. Use for loop. Kilograms Pounds 1 2.2 2 4.4 . 100 220.0 Figure 1: Sample of Output (10 marks) (b) Consider the following C++ program segment: num = 0; //Line 1 while (num 3) Numbers[i] = Numbers[i] / 4; Figure 2: C++ Code Segments (a) What is stored in Numbers [] after the following C++ code executes? Draw memory illustration diagram to show the final values of each memory. (10 marks) (b) Write the C++ statements to modify the above code to change the size Numbers [] to 20 and sum all elements and output it. (5 marks) (c) Write the C++ statements to declare new array name your Numbers [] and copy the content of Numbers [] into it. Then output the highest and lowest value in your Numbers []. (10 marks) Question 3 Write a program to process series of daily temperatures. The program should count and print until user inputs -99 to stop the program: the number of hot days (85 or higher), the number of pleasant days (60-84), and the number of cold days (less than 60). It should also display the category of each temperature. At the end of the run, display the average, highest and lowest temperature Sample output of the program is as given below in Figure 3. Enter temperature: 77 177 is a pleasant day Enter temperature: 37 37 is a cold day Enter temperature: 65 65 is a pleasant day Enter temperature: 65 65 is a pleasant day Enter temperature: 85 85 is a hot day Enter temperature: -99 The collection of hot days is 1 The collection of pleasant days is 3 The collection of cold days is 1 The average temperature is 65.8 The highest temperature is 85 The lowest temperature is 37 Figure 3: Sample of Output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
