C++ Write a function named averageScores that takes in a float array of scores and the array’s size (stored as an int) as parameters. For each element in the array, ask the user to input a score and store it in the element. Then add that element to a running total of all the scores created in the array. Once you have gone through every element in the array, return the average of all of the scores.
Q: Write C++ application with several functions that deal with a two-dimensional array of positive…
A: The problem shows a need of printing a 20*20 matrix having random numbers from 1 to 1000. It then…
Q: Q2(a) (i) Write a C++ program to read a size of an array (D) and then read the array elements from…
A: Given:
Q: Instructions Write a program in C++ that uses a two-dimensional array to store the highest and…
A: Program: #include <iostream> using namespace std; void getData(int temperatures[2][12]) {…
Q: Question 1. Write a C program that checks if elements of an array is even or odd. It should include…
A: A function is a block of code that performs a specific task. After defining the function we can call…
Q: Q2: Write a C++ function (call it index_max) that finds the maximum number in the array, that is…
A: The above question is solved in step 2:-
Q: Write a value-returning function that receives an array of integer values (as user input) and the…
A: Required: Write a value-returning function that receives an array of integer values (as user input)…
Q: 4. Given two unsorted arrays of integer numbers, write a function which returns number of elements…
A: Program: Programs contain the general instruction given to the computer to perform certain tasks.…
Q: Given a series of positive integers representing the prices of a single stock on various days (in…
A: Java Code: import java.io.*; class Solution { //The function calculates the maximum profit by…
Q: In C++, write a function that uses a 2D array to act as a coordinate system in order to draw circles…
A: Draw Circle:- I'm trying to write a program for creating .pgm and .ppm and am trying to draw a…
Q: Write a function called nth that finds the n-th occurrence of a particular value in an array of…
A: So, here we have to write a C function for finding the nth occurrence For this, we have used array…
Q: Write a function C++ void switchEnds(int *array, int size); that is passed the address of the…
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT----------------
Q: Write a function called double getAverage(int *array, int SIZE), where it accept the array as…
A: Question has asked to write a function in C++ called double getAverage(int *array, int SIZE)…
Q: Write a C++ function (along with helper functions) that prints out all the prime numbers in a given…
A:
Q: Write a function that accepts an int array and the array’s size as arguments. The function should…
A: We have to write a function that has two arguments: an array and its size. The function creates a…
Q: This part requires that you implement a C function that takes in as parameters two arrays and their…
A: #include <stdio.h>//method to find and print longest common sequencevoid…
Q: Start with a program that allows the user to input a number of integers, and then stores them in an…
A: Declare the header files. Define the Function maxInt and pass the array and number of elements.…
Q: Write a function void switchEnds(int *array, int size);that is passed the address of the beginning…
A: Function: void exchange(int *p, int *q){int temp = *p;*p = *q;*q = temp;}
Q: C++ Write a function called bool neverZero(...) It takes an array of integers and the array size…
A: bool neverZero(int arr[], int size): Start for i = 0 to size follow step 3 if arr[i] == 0 then…
Q: Write a function named(difference), that accepts an integer one-dimensional array and its size,…
A: The programming methodology is given by: Including header files Difference function that takes 1d…
Q: Q3: write a program to pass a two dimensional array as a parameter to a function which is used to…
A: Note: since programming language is not mention we are provide solution in c programming . please…
Q: C++ Write a definition of a function called MAX which receives an integer array and its size…
A: #include <iostream> using namespace std; /*Define a function MAX() which receives an integer…
Q: Write a function that returns trueif the product of an array is divisible by the sum of that same…
A: Program def divisible(myList) : mul = 1 s=0 for x in myList: mul = mul * x for i…
Q: Programing in C Write a program that calculates the average grade of a class. 1. You should ask the…
A: Below is the C program and its approach to calculating the average grade of a class: - Approach: -…
Q: 2. Write a function that has one parameter which is an array of type double with 50 elements. The…
A: #include <iostream> using namespace std; // Function to find the last negative element in the…
Q: C++ simple function Write a function called bool never13(...) It takes an array of…
A: #include<iostream>using namespace std;bool never13(int arr[],int size);int main(){int…
Q: Write a function called gen_dates() that generates random dates. It takes two arrays of integers…
A: Actually, program is a executable software that runs on a computer.
Q: Write a function definition for a function named getLast which does the following: 1) Accepts the…
A: In step 2, you will the C++ code.In step 3, you can see the sample output.
Q: Write a recursive function to find the factorial of a number. Use the defined function to compute…
A: The required C++ program code is given below:…
Q: Write a C program that read 6 weight values (in kilogram) of 10 adults entered by the user and store…
A: #include<stdio.h>float percentage(float sum,float high) //percentage calculation{ float…
Q: An integer double-dimensional array called hotel is used to keep track of reservations in an hotel…
A: The solution for the above given question is given below:
Q: 1. Write a Swift function that takes an array as a parameter and returns a boolean value whether the…
A: Write a Swift function that takes an array as a parameter and returns a boolean value whether the…
Q: dissolve in c ++. Below, write the code of the program that calls the desired functions in the main…
A: Given: We are given a problem where we have to perform some operations. Random 10 integers are…
Q: Part 1 Write a function that takes an integer array and the size of the array The array is…
A: The answer is given below:-
Q: Q: Write a C++ function (call it search) that searches for a number in the array, that is passed to…
A: Coded in C++.
Q: Write a program with a function which accepts an array of integers and a key value.The function…
A: Start Input number of elements in array Input all values in array Input key For each element in…
Q: 2. Write a program that takes an array large enough to hold a user-defined number of test scores.…
A: As per our policy, we are answering the first question. Kindly submit the remaining question…
Q: Write a function named(difference), that accepts an integer one-dimensional array and its size,…
A: Here in the main method I have defined an array and assigned the numbers to that array. Now I have…
Q: Write a function int mark(char key[],char answer(]) The function will be used to grade…
A: Given:
Q: a. Write a C function called find, which receives the following 3 parameters: an integer…
A: C function called find, which receives the following 3 parameters: an integer array, the array size,…
Q: I want it with C function please. Write a C function named(difference), that accepts an integer…
A: Code: Code copy: #include<stdio.h>int difference(int arr[], int size) //declaring and…
Q: Write a C++ function that is supposed to take as a parameter a pointer to an array named salaries…
A: #include <iostream>using namespace std;//method that takes salaries array as pointer, size of…
Q: Write a function that gets an array as a parameter (address and size) and a number and checks to see…
A: PROGRAM: //Header file #include <stdio.h> //Defining the findnReport() function void…
Q: C++ Write a value-returning function that receives an array of integer values and the array size as…
A: Input : Function with array values and its size Output : Count the number of elements that are…
Q: Write a function that accepts two arguments, an array of integers and a number indicating the number…
A:
Q: 1. Please write the C code of the following question and then convert it into an equivalent MIPS…
A: Actually, function is a group of statements.
Q: (a) Write a function number() that receives a string as its argument and returns a code number…
A: The character array is a collection of characters stored in a linear array data structure. The…
C++
Write a function named averageScores that takes in a float array of scores and the array’s size (stored as an int) as parameters. For each element in the array, ask the user to input a score and store it in the element. Then add that element to a running total of all the scores created in the array. Once you have gone through every element in the array, return the average of all of the scores.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- Instructions Write a program in C++ 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: Function getData: This function reads and stores data in the two-dimensional array. Function averageHigh: This function calculates and returns the average high temperature for the year. Function averageLow: This function calculates and returns the average low temperature for the year. Function indexHighTemp: This function returns the index of the highest high temperature in the array. Function indexLowTemp: This function returns the index of the lowest low temperature in the array. These functions must all have the appropriate parameters. An example of the program is shown below: Enter high temperature for each month 60 68 72 72 73 76 80 81 75 72 67 66 Enter low temperature for…use C++ programming language Write a modular program that analyzes a year’s worth of rainfall data. In addition to main, the program should have a getData function that accepts the total rainfall for each of 12 months from the user and stores it in an array holding double numbers. It should also have four value-returning functions that compute and return to main the totalRainfall, averageRainfall, driestMonth, and wettestMonth. These last two functions return the number of the month with the lowest and highest rainfall amounts, not the amount of rain that fell those months. Notice that this month number can be used to obtain the amount of rain that fell those months. This information should be used either by main or by a displayReport function called by main to print a summary rainfall report similar to the following: 2019 Rain Report for Springdale County Total rainfall: 23.19 inches Average monthly rainfall: 1.93 inches The least rain fell in January with 0.24 inches. The most rain…Programing in C Write a program that calculates the average grade of a class. 1. You should ask the user how many students you have (you will use this number to set up the length of your array of decimals). 2. Once you have your array, you will have to ask the user for all the grades (there should only be one grade per student). Using a while loop. 3. While you are scanning the grades, you should check if the inputted grade is in the range 0.0 to 10.0 (inclusive). If the grade is not in this range, you should display a message to the user and assign 0.0 to the grade. 4. Once your array is populated with all student's grades, print out the values of the array, so that the user knows these values were saved correctly (use a while loop as well). 5. After this calculate the average (add up all grades and divide by the number of students). Hint: You will need a loop to do so; please use a while loop as well. Example: How many students are in your class? 8 Please input the grades: 8.5 9.8…
- Using c++ Write a modular program that analyzes a year’s worth of rainfall data. In addition to main, the program should have a getData function that accepts the total rainfall for each of 12 months from the user and stores it in an array holding double numbers. It should also have four value-returning functions that compute and return to main the totalRainfall, averageRainfall, driestMonth, and wettestMonth. These last two functions return the number of the month with the lowest and highest rainfall amounts, not the amount of rain that fell those months. Notice that this month number can be used to obtain the amount of rain that fell those months. This information should be used either by main or by a displayReport function called by main to print a summary rainfall report similar to the following: 2019 Rain Report for Springdale County Total rainfall: 23.19 inches Average monthly rainfall: 1.93 inches The least rain fell in January with 0.24 inches. The most rain fell in April with…JAVA CODE PLEASE Functions with 2D Arrays Practice ll by CodeChum Admin Write a function named displayElements that takes a two-dimensional array, the size of its rows and columns, then prints every element of a two-dimensional array. Separate every row by a new line and every column by a space. In the main function, write a program that asks for integer input to be assigned on a 3 x 3 array and call the function displayElements to print the contents on the next line. Input 1. Multiple lines containing integer each line Output R1C1:·1 R1C2:·2 R1C3:·3 R2C1:·4 R2C2:·5 R2C3:·6 R3C1:·7 R3C2:·8 R3C3:·9 1·2·3 4·5·6 7·8·9 Score:a C++ program that creates a two-dimensional integer array (4x3) initialized with user given data. The program should have the following functions: • Print the sum of all values in the array. • Print the average of all the values in the array. • Take row number from user and print the sum of the values in that specified row.(use loop and no if statement) • Take column number from user and print the sum of the values in that specified column.(use loop and no if statement)
- In C++Monkey Business A local zoo wants to keep track of how many pounds of food each of its three monkeys eats each day during a typical week. Write a program that stores this information in a two-dimensional 3 × 5 array, where each row represents a different monkey, and each column represents a different day of the week. The program should first have the user input the data for each monkey. Then, it should create a report that includes the following information: Average amount of food eaten per day by the whole family of monkeys. The least amount of food eaten during the week by any one monkey. The greatest amount of food eaten during the week by any one monkey. Write functions: average() least() greatest() main()C++ PLEASE INCLUDE COMMENTS Write one program that does the following: Ask the user for ten (10) grades, and store the data in an array. Compute the average of all the grades. Print the original ten grades and the average. Declare an integer array with the name of “grades” of size 10 in the main function. Create a function called “getGrades” that prompts the User for the grades and puts them in an integer array. The function will receive an integer array and the size of the array. In the function prototype and the function header, call the array “gradeArray” and call the size of the array "size." iii. Create a For Loop that cycles through each cell of the array. At each cell prompt the User for a grade. Store the grade entered by the User into the array cell. From main, send this function the array called “grades” and the size of the array. Create a function called “computeAverage” that…Use C++ programing language Write a modular program that analyzes a year’s worth of rainfall data. In addition to main, the program should have a getData function that accepts the total rainfall for each of 12 months from the user and stores it in an array holding double numbers. It should also have four value-returning functions that compute and return to main the totalRainfall, averageRainfall, driestMonth, and wettestMonth. These last two functions return the number of the month with the lowest and highest rainfall amounts, not the amount of rain that fell those months. Notice that this month number can be used to obtain the amount of rain that fell those months. This information should be used either by main or by a displayReport function called by main to print a summary rainfall report similar to the following: 2019 Rain Report for Springdale County Total rainfall: 23.19 inches Average monthly rainfall: 1.93 inches
- 1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.Searching an Array for an Exact Match Summary In this lab, you use what you have learned about searching an array to find an exact match to complete a partially prewritten C++ program. The program uses an array that contains valid names for 10 cities in Michigan. You ask the user to enter a city name; your program then searches the array for that city name. If it is not found, the program should print a message that informs the user the city name is not found in the list of valid cities in Michigan. The file provided for this lab includes the input statements and the necessary variable declarations. You need to use a loop to examine all the items in the array and test for a match. You also need to set a flag if there is a match and then test the flag variable to determine if you should print the the Not a city in Michigan. message. Comments in the code tell you where to write your statements. You can use the previous Mail Order program as a guide. Instructions Ensure the…While passing an array as an actual argument, the function call must have the array name A. with empty brackets B. with its size C. alone D. none of the above