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

1. Write a void function that will populate an array by prompting the user for v

ID: 3627295 • Letter: 1

Question

1. Write a void function that will populate an array by prompting the user for values, and storing them in the array.
2. Write an int function that will find the minimum value in the array. The function should have the minimum value as its return value.
3. Write a Boolean function that will prompt the user for a target value. The function will then search the array to see if it contains the target value. If the target value is found, the function will return "true." If the target value is not found, it will return "false."
4. Write a void function that will "process" the values in the array. The function will check each array value to see if it is even. If it is even it will do nothing. If it is odd, it will multiply the value by 2, and store the new value at the same index location.
5. Write a void function that will print the elements in the array.

6.Main() function should declare the array size, prompt the user for values and call the functions stated above.

Explanation / Answer

#include<iostream>
using namespace std;
void fill(int a[])
{
for(int i=0; i<10; i++)
{
cout << "Enter value " << (i+1) << " : ";
cin >> a[i];
}
}
int min(int a[])
{
int min = a[0];
for(int i=1; i<10; i++) {
if(a[i]<min) min = a[i]; }
return min;
}
bool target(int a[],int k)
{
for(int i=0; i<10; i++)
if(a[i]==k) return true;
return false;
}
void process(int a[])
{
for(int i=0; i<10; i++)
{
if(a[i]%2 ==0) continue;
else a[i] = 2*a[i];
}
}
void print(int a[])
{
for(int i=0; i<10; i++)
cout << a[i] << " ";
}
int main()
{
int a[10];
fill(a);
cout << "minimum is " << min(a) << endl;
cout << " Value found is " << target(a,10) << endl;
process(a);

print(a);
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote