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😓

17th Apr 2018, 4:57 PM
dlayel alanazi
dlayel alanazi - avatar
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.
17th Apr 2018, 5:03 PM
Hatsy Rei
Hatsy Rei - avatar
+ 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.
17th Apr 2018, 5:30 PM
Hatsy Rei
Hatsy Rei - avatar
+ 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
17th Apr 2018, 6:15 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 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!
17th Apr 2018, 7:11 PM
Ipang
+ 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; }
17th Apr 2018, 7:13 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 2
Look at Brains' answer, that would be the implementation, Brains' code above will do the task : )
17th Apr 2018, 7:41 PM
Ipang
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; }
17th Apr 2018, 6:35 PM
dlayel alanazi
dlayel alanazi - avatar
0
This is my attempt to solve .. What is the appropriate code and appropriate parameters??
17th Apr 2018, 6:42 PM
dlayel alanazi
dlayel alanazi - avatar
0
@Ipang ....Can you explain his writing as a program .. because I did not understand
17th Apr 2018, 7:40 PM
dlayel alanazi
dlayel alanazi - avatar