48 lines
1.0 KiB
C++
48 lines
1.0 KiB
C++
|
/*
|
|||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|||
|
* Click nbfs://nbhost/SystemFileSystem/Templates/cppFiles/class.cc to edit this template
|
|||
|
*/
|
|||
|
|
|||
|
/*
|
|||
|
* File: arrays.cpp
|
|||
|
* Author: caleb
|
|||
|
*
|
|||
|
* Created on March 1, 2024, 11:11 AM
|
|||
|
*/
|
|||
|
|
|||
|
#include <iostream>
|
|||
|
using namespace std;
|
|||
|
#include "arrays.h"
|
|||
|
|
|||
|
void initializeArray (int arr[], const int size) {
|
|||
|
for (int i = 0; i < size; ++i) {
|
|||
|
arr[i] = i+10;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void printArray(int arr[], const int size) {
|
|||
|
for (int i = 0; i < size; ++i) {
|
|||
|
cout << arr[i] << " ";
|
|||
|
}
|
|||
|
cout << endl;
|
|||
|
}
|
|||
|
|
|||
|
int& returnAddressOfFirstElementOfArray (int arr[3]) {
|
|||
|
return arr[0];
|
|||
|
}
|
|||
|
|
|||
|
int findMaxAndMin(int arr[2][3], int & min) {
|
|||
|
int max = arr[0][0];
|
|||
|
min = arr[0][0];
|
|||
|
for (int i = 0; i < 2; ++i) {
|
|||
|
for (int j = 0; j < 3; ++j) {
|
|||
|
if (min > arr[i][j]) {
|
|||
|
min = arr[i][j];
|
|||
|
}
|
|||
|
if (max < arr[i][j]) {
|
|||
|
max = arr[i][j];
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return max;
|
|||
|
}
|