c++ question need help
Write a function pairWise that takes four parameters: two arrays of int and the size of the first array. The size of the first array is
guaranteed to be exactly twice the size of the 2nd array
The function takes each pair of integers from the first array and stores the product in the 2nd array.
ex: if the first array is {2, 7, 3, 4}, then the second array will end up with {14, 12}#include <iostream>
using namespace std;
void pairWise(int arr1[], int arr2[], int size){
int k = 0;
for(int i = 0;i<size;i+=2){
arr2[k++] = arr1[i]*arr1[i+1];
}
}
int main()
{
int arr1[] = {2, 7, 3, 4};
int arr2[2];
pairWise(arr1,arr2,4);
for(int i = 0;i<2;i++){
cout<<arr2[i]<<" ";
}
return 0;
}



c++ question need help Write a function pairWise that takes four parameters: two arrays of int...
c++ question need help Write a function pairWise that takes four parameters: two arrays of int and the size of the first array. The size of the first array is guaranteed to be exactly twice the size of the 2nd array The function takes each pair of integers from the first array and stores the product in the 2nd array. ex: if the first array is {2, 7, 3, 4}, then the second array will end up with {14, 12}
c++ program need help Write a function allBigger that takes 3 parameters: 2 arrays of floats and an int that represents the length of each array The function returns true if at every position, the value in the first array is strictly greater than the value in the 2nd array, false if not. For example: {1.3, 7.4, 2.51} and {1.0, 2.1, 3.2} would return false because 2.51 < 3.2
c++ program need help Write a function allBigger that takes 3 parameters: 2 arrays of floats and an int that represents the length of each array The function returns true if at every position, the value in the first array is strictly greater than the value in the 2nd array, false if not. For example: {1.3, 7.4, 2.51} and {1.0, 2.1, 3.2} would return false because 2.51 < 3.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. To test your
function, write a main that prompts a user for a list of 15
integers and outputs the index and value of the first occurrence of
the smallest value.
The program should print out
Enter 15 integers:
The position of the first occurrence of the smallest element in...
c++ write a function that has 3 parameters, two arrays of integers of the same size , and the size of the arrays. the function should add the two arrays and store the results in a third array, then print out the contents of the third array name it arraya
c++ Write a function has Match that takes 3 parameters: 2 arrays of strings and an int that represents the length of each array The function returns true if at any position, the two arrays have the same string, false if not. For example: {"a", "b", "cat", "d"} and {"1", "2", "cat", "4"} would match
Define a function called DisplayMax that has 3 parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMax must work when called with various types of actual arguments, for example string DisplayMax(string names[], int calories[], int size) or int DisplayMax(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with the...
In C++ Write a function that accepts two int arrays of the same size. The first array will contain numbers and the second array will be filled out inside the function. The function should find all numbers in the array that are greater or equal to the average and fill out the second array with these numbers. You need to design the function. I tried this code but the errors returned were: expression must have a constant value #include<iostream> using...
3. Write a void functions named Complement that takes two bool arrays and an int as parameters named RA, RB and n respectively. With n representing the size of both RA and RB, the function assigns the twos-complement of RA to RB where the least significant figure starts from index 0.
3. Write a void functions named Complement that takes two bool arrays and an int as parameters named RA, RB and n respectively. With n representing the size of...
A function that takes three parameters: an int array, an int n that is the size of the array and an int pointer max that is to assign the maximum value in the array. The function will find and return the index of the first occurrence of the maximum value in the array and assign the maximum value to the pointer. For example, in the array {1, 2, 6, 5, 6, 4, 3, 6, 4}, the maximum value is 6...