Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help, also need optional question too! Thank you! Needs to build and run

ID: 3604874 • Letter: P

Question

Please help, also need optional question too! Thank you! Needs to build and run

CSCI 40 Computer Programming in C++ Assignment 15 . Write a function that receives an integer array along with its length, and then calculate and return the highest number in the array Write a function that receives an integer array along with its length. The function will not have a return value, and it only adds 10 to every integer in the array that the function receives . Write a function that receives an integer array along with its length, and then calculate and return the total number of the integers that are greater than or equal to 70 in the array . Write a function that receives an integer array along with its length, and then calculate and return the sum of every other numbers in the array . . Write a function that receives an integer array along with its length, and then calculate and return the index of the largest number in the array .(Optional) Write a function that receives an integer array along with its length. The function will not have a return value. It will shift all the numbers in the array to the right by one place except the last number in the array. For example, if an array has following numbers: 1.2. 3.4, 5, 6,7, 8, 9, 10 After the function call, the numbers in the array will be 1. 1,2, 3, 4, 5, 6, 7, 8, 9

Explanation / Answer

#include<iostream>
using namespace std;

main()
{
// this is for part 1
int a[10] = {2,3,4,1,5,65,3,60,80,7};
cout<< "Maximum is " << first_max(a,10) << endl;
/* Sample output is
Maximum is 8 */
  
  
// This is for part 2
second_increase10(a,10);
cout << "Values after the function: ";
for(int i=0; i<10; i++)
{
cout << a[i] << " ";
}
/*SAMPLE OUTPUT
Values after the function: 12 13 14 11 15 14 13 16 18 17 */
  
// This is part 3
cout <<endl << "Greater 70 are " << third_greater70(a, 10) << endl;
/*SAMPLE OUTPUT
Greater 70 are 3
*/
  
// This is for part 4
cout << "The sum is " << fourth_sum(a,10) << endl;
/* SAMPLE OUTPUT
The sum is 330
*/
}

int first_max(int a[], int len)
{
int max = a[0];
for(int i=1;i<len;i++)
{
if(max < a[i])
{
max = a[i];
}
}
return max;
} void second_increase10(int a[], int len)
{
for(int i=0;i<len;i++)
{
// it increases every element by 10
a[i] = a[i] + 10;
}
} int third_greater70(int a[], int len)
{
int total = 0;
for(int i=0;i<len;i++)
{
// increamenting total by 1 if the element is greater than or equal to 70
if(a[i]>=70)
total++;
}
return total;
} int fourth_sum(int a[], int len)
{
int sum = 0;
for(int i=0;i<len;i++)
{
// it adds every element to sum
sum = sum + a[i];
}
return sum;
}