Syncing to work on interview with entrepreneur essay
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
float arrMaxf(float* arr, unsigned int length)
|
||||
{
|
||||
float max = *arr;
|
||||
float current;
|
||||
|
||||
for (unsigned int i = 1; i < length; ++i)
|
||||
{
|
||||
current = *(arr+i);
|
||||
if (current > max)
|
||||
{
|
||||
max = current;
|
||||
}
|
||||
}
|
||||
|
||||
return max;
|
||||
}
|
||||
|
||||
float arrMinf(float* arr, unsigned int length)
|
||||
{
|
||||
float min = *arr;
|
||||
float current;
|
||||
|
||||
for (unsigned int i = 1; i < length; ++i)
|
||||
{
|
||||
current = *(arr+i);
|
||||
if (current < min)
|
||||
{
|
||||
min = current;
|
||||
}
|
||||
}
|
||||
|
||||
return min;
|
||||
}
|
||||
|
||||
unsigned int arrMaxfIndex(float* arr, unsigned int length)
|
||||
{
|
||||
float max = *arr;
|
||||
float current;
|
||||
unsigned int maxIndex = 0;
|
||||
|
||||
for (unsigned int i = 1; i < length; ++i)
|
||||
{
|
||||
current = *(arr+i);
|
||||
if (current > max)
|
||||
{
|
||||
max = current;
|
||||
maxIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
return maxIndex;
|
||||
}
|
||||
|
||||
unsigned int arrMinfIndex(float* arr, unsigned int length)
|
||||
{
|
||||
float min = *arr;
|
||||
float current;
|
||||
unsigned int minIndex = 0;
|
||||
|
||||
for (unsigned int i = 1; i < length; ++i)
|
||||
{
|
||||
current = *(arr+i);
|
||||
if (current < min)
|
||||
{
|
||||
min = current;
|
||||
minIndex = i;
|
||||
}
|
||||
}
|
||||
return minIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user