Chapter 9

QUESTION NO 1

Write a C++ program that declares an array alpha of 50 components of type double. Initialize the array so that the first 25 components are equal to the square of the index variable, and the last 25 components are equal to three times the index variable. Output the array so that 10 elements per line are printed.

Question 1
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

QUESTION NO 2

Write a C++ function, smallestIndex, that takes as parameters an int array and its size and returns the index of the first occurrence of the smallest element in the array. Also, write a program to test your function.

Question 2
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

QUESTION NO 3

Write a C++ function, lastLargestIndex, that takes as parameters an int array and its size and returns the index of the last occurrence of the largest element in the array. Also, write a program to test your function.

Question 3
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

QUESTION NO 4

Write a program that reads a file consisting of students’ test scores in the range 0–200. It should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. Output the score ranges and the number of students. (Run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189.).

Question 7
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

QUESTION NO 5

Write a program that prompts the user to input a string and outputs the string in uppercase letters. (Use a character array to store the string.)

Question 15
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

Question 7

Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name, the number of votes 558 | Chapter 9: Arrays and Stringsreceived, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate Votes Received % of Total Votes Johnson 5000 25.91 Miller 4000 20.73 Duffy 6000 31.09 Robinson 2500 12.95 Ashtony 1800 9.33 Total 19300 The Winner of the Election is Duffy

Question 3
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

Question 9

Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest temperatures for the year. Your program must consist of the following functions: a. Function getData: This function reads and stores data in the twodimensional array. b. Function averageHigh: This function calculates and returns the average high temperature for the year. c. Function averageLow: This function calculates and returns the average low temperature for the year. d. Function indexHighTemp: This function returns the index of the highest high temperature in the array. e. Function indexLowTemp: This function returns the index of the lowest low temperature in the array. (These functions must all have the appropriate parameters.)

Question 3
note: How to Download:
step 1: Click "SOURCE CODE" button.
step 2: Adf.ly Link will appear, Please wait 5 seconds. And then Click Skip.
step 3: Linkbucks page will appear, Please wait 5 seconds and then Click Skip.
step 4: Click Download Button to download.
Thankyou!!!

1 comment: