0
Write C++ program that asks the user to type 10 integers of an array . The program has a function called MinArray that search
for the minimum number in the array . How do I solve the question? please😓
9 Respuestas
+ 6
Mind to show your attempts at the task? You don't have to come up with a solution, just what you have tried so far.
+ 6
As you can see, it is your homework. It is your responsibility to try. We can assist you, but nobody can write your code for you. Our responsibility here is to make sure that the next generation of programmers did not grow up asking for code online.
+ 4
You do not have time,so then youre fine with failing.since youved failed to plan youve planned to plan.i can assist you with this but since youre reluctant to help yourself,i dont give a dime
+ 2
Add two parameters to MinArray, the first will accept the array, the second will accept the number of elements in the array. Next in MinArray, create an int variable (e.g. minVal) to be returned later, initialized to zero. Design a loop to iterate the array with, on each iteration do a check using "if" to compare the n-th element with minVal, whenever you found element n-th is less than minVal assign the value of element n-th into minVal, upon loop exit return minVal. Hope you understand, good luck!
+ 2
int findMinArr(int arr[],int n){
//where n is arrays length
int temp = arr[0];
for(int i=0; i<n; i++) {
if(temp>arr[i]) {
temp=arr[i];
}
}
return temp;
}
+ 2
Look at Brains' answer, that would be the implementation, Brains' code above will do the task : )
0
#include <iostream>
using namespace std;
int minArray( ) {
}
int main() {
int UserArray[10];
cout<<" please Enter 10 numbers: ";
for(int i=10; i<10; i++)
cin >> A[i];
cout <<" the minimum number is"<< minArray ( )<< endl ;
return 0;
}
0
This is my attempt to solve .. What is the appropriate code and appropriate parameters??
0
@Ipang ....Can you explain his writing as a program .. because I did not understand