C++ Functions:
3)
double Temprature(double F{
double celcius=(5/9)*(F-32);
return celius;
}
b)
#include <iostream>
using namespace std;
double* Math(int a,int b){
static double arr[2];
double sum=a+b;
double avg=sum/2.0;
arr[0]=sum;
arr[1]=avg;
return arr;
}
int main(){
int a=5,b=6;
double* arr=Math(a,b);
cout<<"Sum is "<<arr[0];
cout<<"Avg is "<<arr[1];
}
if you like the answer please provide a thumbs up;
Average-(a+b)/2; 3. Define the following functions: (2 x 10 = 20 points) a) Define a function...
Write a program in C that will convert all 12 months' average temperature from Celsius to Fahrenheit. You need to create an array named aye jump and prompt the user to input average temperature in Celsius for all 12 months. After that, you need to develop a user temperatures from Celsius to Fahrenheit and pass the array as reference and convert all temperatures from Celsius to Fahrenheit. Next, compute the average temperature of the year and assign it to a...
Problem H1 (Using C++) In the main function, define four variables of type int, named: first, second, third, and total. Write a function named getData that asks the user to input three integers and stores them in the variables first, second, and third which are in the main function. Write a function named computeTotal that computes and returns the total of three integers. Write a function named printAll that prints all the values in the format shown in the following...
c++
U CHU PO J O ! Week 11 Homework-Functions X + /bbcswebdav/pid-2592362-dt-content-rid-39864984_1/courses/CSC-170-03-191/CSC%20170%20Program%205%20%26% CSC 170 - 03 Fall 2019 Program 5 & 6 You are required to write a program which reads five test scores and computes and prints the sum and average of these test scores. Note: This program should not use arrays. You are required to produce two versions of this program Version 1 Program 5 In the first version you must use the following: 1. Avoid function...
**IN C***
*
In this lab, you will write a program with three recursive functions you will call in your main. For the purposes of this lab, keep all functions in a single source file: main.c Here are the three functions you will write. For each function, the output example is for this array: int array[ ] = { 35, 25, 20, 15, 10 }; • Function 1: This function is named printReverse(). It takes in an array of integers...
c++
Question 1 ram that calls a function calculateSum to calculate the sum from 0 to N integers. The function calculateSum has one parameter N of type integer and returns an integer which represents the sum from 0 to N, inclusive. Write another function calculateAverage that calculates an average. This function will have two parameters: the sum and the number of items. It returns the average (of type float) The main function should be responsible for all inputs and outputs....
C++ 2) Functions with arrays • Write a function that returns a count of how many temperatures are below freezing (32 degrees Fahrenheit). The function takes two parameters: i) temps, an array of temperatures (in Fahrenheit degrees) ii) numTemps, the number of temperatures • Write a main() that initializes an array of temperatures (hard-coding the values is fine) and prints the number of temperatures below freezing. Your main() must call the above function to compute this result for output.
Student ID: 123
Write a C+ program with the following specifications: a. Define a C++ function (name it function_StudentlD where StudentID is your actual student ID number) that has one integer input (N) and one double input (x) and returns a double output S, where N S = n 0 and X2 is given by 0 xeVn n 0,1 Хл —{2. nx 2 n 2 2 m2 x2 3 (Note: in the actual quiz, do not expect a always, practice...
Define two arrays x and f. cach of size 10. using call-hy-reformer (that is, use pointers), to pass the array to a function. named sum. In main: define array, pass arrays, print out the array and the results on screen In function sum, take arrays from main and sum the arrays using the formula below: Sum = sigma_1^10 e^x1 + x_1^3 - 3x_162 + 5x_i
1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...
Write a complete program that uses the functions listed below. Except for the printOdd function, main should print the results after each function call to a file. Be sure to declare all necessary variables to properly call each function. Pay attention to the order of your function calls. Be sure to read in data from the input file. Using the input file provided, run your program to generate an output file. Upload the output file your program generates. •Write a...