Done in C++ using visual studio
1. Write a program with one additional function called int[] reverseArray(int array). This function will receive an array from main and then reverse and should return the reversed array to the main to print out. Use a single array and a single loop, you’re are neither allowed to print out just in reverse order nor allowed to use another array variable to store the original array in reverse order.
2. Write a program which will implement following using 2d array and methods:
a. Function SumLeftDiagonal() will calculate the summation of the elements of right diagonal of the 2d array.
b. Function SumCol() will calculate the summation of every column of the 2d array.
c. Function MaxInRow() will find out the max value of every row of the 2d array.
Sample Output:
The Summation of right diagonal elements is: 17
The Summation of column 1 is: 9
…………………………………………………………………………………
…………………………………………………………………………………
The Maximum value of row 1 is: 7
……………………………………………………………………………………
……………………………………………………………………………………
1)
CODE
#include <iostream>
using namespace std;
int* reverseArray(int arr[], int n) {
for (int low = 0, high = n - 1; low < high; low++, high--) {
int t = arr[low];
arr[low] = arr[high];
arr[high] = t;
}
return arr;
}
void display(int arr[], int n)
{
for (int i = 0; i < n; i++) {
cout << arr[i] << " ";
}
}
int main() {
int arr[] = {10, 20, 30, 40, 50, 60};
int n = sizeof(arr)/sizeof(arr[0]);
int *res;
res = reverseArray(arr, n);
display(res, n);
return 0;
}

NOTE: As per Chegg policy I am allowed to answer specific number of questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
Done in C++ using visual studio 1. Write a program with one additional function called int[]...
C++ Write a function called reverseArray(char[] , int) that accepts in an array of chars and the size of the array.as parameters. The function should then create a new array that is the same size as the original array. The function should copy the elements from the first array into the second array in reverse order. So if the initial array is {'a' , 'b', 'c'} then the new array will be {'c', 'b', 'a'} Then in your main(), create...
C++. Write a program that copies the contents of one array into another array but in reverse order using pointers. - in main() - define 2 arrays of type int, 10 elements each - initialize one array with numbers 1 through 10 - initialize all elements of the second array to 0 - call function reverseCopy with both arrays as arguments - display the values of array number 2 (reversed order) - reverseCopy...
1. Write a C programme by using visual Studio: a) Write a function with parameters that returen the largest of three integer arguments. So users could call your function (name: max3) to output the maximum of three input values. b) Make a function outside of the main routine. And in the main routine, please call this function and print the harmonic mean. The harmonic mean of two numbers is obtained by taking the inverses of the two numbers, averaging them,...
Write a program to reverse an integer number by using a function
called reverse. The program reads in an integer number and prints
its reverse order. Note that the function receives the number via a
pointer, and uses the pointer to write the reverse number on the
main function.
The function MUST be used AS
IS:
void reverse(int *n)
Language in C
Bonus Problem: Number Reverser reverse c Write a program to reverse an integer number by using a function...
Write a C Program that inputs an array of integers from the user along-with the length of array. The program then prints out the array of integers in reverse. (You do not need to change (re-assign) the elements in the array, only print the array in reverse.) The program uses a function call with array passed as call by reference. Part of the Program has been given here. You need to complete the Program by writing the function. #include<stdio.h> void...
C++ Visual Studio (#include <stdio.h> - NO iostream) Assume this code: int arr[10]; Now write code that fills the array with 10 values of your choosing. Now write code that calculates the average of the first and the last elements of arr. Now print the the calculated average.
dont use switch
E) 120 pts.] Write another function int main ) in C++(and comment the main in Q1.D) that displays the following menu using a do while loop: please choose from the following Menu: I: Populate array with 5 elements 2: Print Array 3: Reverse Array 0: Exit Based, on the user choice, you should call the appropriate function. For example, if the user: - chooses 1, then in function main you should call function populateArray (A, 5); -...
C++ ONLY THANKS!
USE VISUAL STUDIO COMPILER ONLY!
Part 1: Exercise 1: Problem description Write a three function
program (your main function and two other functions). The main
function of the program should create an array that can store 10
integers. The main function will then pass the array to a second
function that gets the integers from the user and stores them in
the array. Then your main will call a third function that displays
the elements in the...
I need help writing these functions in C programming.
Write a C function that checks if an array is sorted or not using an iterative approach. Write a C function that checks if an array is sorted or not using a recursive approach Write a C function to reverse the elements of an array. Note you are not allowed to use an 1. additional array to do that Write a C function to find the sum of the elements of...
Write another function called checkdiag2 (int checkdiag2 (int matrix[][100], int size)) that will return 1 if all the numbers on the antidiagonal are the same and 0 otherwise. Rewrite your main program to use 2D dynamic allocation instead for your array. Your array will have rows and columns depending of the first integer read from the file. Call your function from the main program. A typical report would look like The matrix is 8x8 and all the numbers on the...