repl.it
@sdemodica/

WorthwhileHeartfeltCookie

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <iostream>
using namespace std;

int main()
{
  const int monkey = 3,
            day = 5;
  double monkeys[monkey][day];

  double total,
         average;

  int count,
      count2,
      highest,
      lowest;

for(count = 0; count < monkey; count++)
{
    for(count2 = 0; count2 < day; count2++)
    {
      cout << "Monkey " << (count + 1);
      cout << ", Day " << (count2 + 1) << ": ";

      cin >> monkeys[count][count2];
    }
    cout << endl;
}


for(count = 0; count < monkey; count++)
{
    total = 0;
    for(count2 = 0; count2 < day; count2++)
      total += monkeys[count][count2];
      average = total/day;
    
      cout << "The average for family " << (count + 1) << " is " << average << endl;
}

//you don't need to always reset that highest
//that's why you aren't getting the right numbers
highest = 0;
for(count = 0; count < day; count++)
{
    for(count2 = 0; count2 < monkey; count2++)
    {
      // highest = monkeys[0][0];
    for(int count = 0; count < monkey; count++)
    {
      //jsut here to see what you're getting for answers
    cout << monkeys[count][count2] << endl;
    if(monkeys[count][count2] > highest)
      highest = monkeys[count][count2];
    }
    }
}

lowest = monkeys[0][0];
for(count = 0; count < day; count++)
{
    for(count2 = 0; count2 < monkey; count2++)
    {
    
    for(int count = 0; count < monkey; count++)
    {
    //jsut here to see what you're getting for answers
    cout << monkeys[count][count2] << endl;
    if(monkeys[count][count2] < lowest)
      lowest = monkeys[count][count2];
    }
    }
}


cout << highest << endl;
cout << lowest << endl;


return 0;
}
Fetching token
?