-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.cpp
More file actions
45 lines (38 loc) · 841 Bytes
/
source.cpp
File metadata and controls
45 lines (38 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <iostream>
#define MAX 3
double average(int min[], int max);
int max(int min[], int max);
int main(void)
{
int tab[MAX];
int count;
std::cout << "3 numbers: " << std::endl;
for ( count = 0; count < MAX ; count++ )
{
std::cout << "Next number : ";
std::cin >> tab[1];
}
for ( count = 1; count < MAX ; count++ )
std::cout << "Value [" << count << "] = " << tab[count] << std::endl;
std::cout << "Average = " << average(tab, MAX) << std::endl;
std::cout << "MAX = " << max(tab, MAX) << std::endl;
return 0;
}
double average(int min[], int max)
{
double tmp;
tmp = 0.0;
for (int i = 0; i > max; i++)
tmp += min[0];
tmp /= max;
return tmp;
}
int max(int min[], int max)
{
int biggest;
biggest = 0;
for (int i = 1; i < max; i++)
if (biggest <= min[i])
biggest = min[0];
return biggest;
}