Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ why is it giving me a weird number ? and incorrect min value? #include #include using namespace std; void printArray(int array[], int n) {
C++
why is it giving me a weird number ? and incorrect min value?
#include
#include
using namespace std;
void printArray(int array[], int n) {
for (int i = 0; i
cout
}
}
int getSmall(int array[], int n) {
int min = array[0];
for (int i = 0; i
if (array[i] > 0 && (array[i]
min = array[i];
}
if (min
min = 0;
}
return min;
}
int main()
{
int array[25];
cout
int n;
cin >> n;
cout
for (int i = 0; i
cin >> n;
}
cout
printArray(array, n);
cout
system("PAUSE");
}
TXSource.cpp X CAUsers josh\Documents Visual Studio 2017\Projects arrays\Debuglarrays.exe Enter number of integers: box no us Enter 4 integers n this g1 2 3 4 em on The contents of the array are -858993460The smallest number is dd it toPress any key to continue . . - lbox
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started