-
Notifications
You must be signed in to change notification settings - Fork 0
/
4_10.cpp
45 lines (38 loc) · 906 Bytes
/
4_10.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
#include <iostream>
#include <array>
using namespace std;
int main()
{
int times = 0;
double sum = 0;
/*
double * pRecord = new double [3];
for(times = 0; times < 3; times++)
{
cout << "Please enter your #" << times << " record of your 40 yards: ";
while(!(cin >> pRecord[times]))
{
cout << "Error! Please re-enter your recode: ";
cin.clear();
cin.sync();
}
sum += pRecord[times];
}
*/
array<double, 3> records;
for(times = 0; times < 3; times++)
{
cout << "Please enter your #" << times << " record of your 40 yards: ";
while(!(cin >> records[times]))
{
cout << "Error! Please re-enter your recode: ";
cin.clear();
cin.sync();
}
sum += records[times];
}
cout << "You entered " << times << " records." << endl;
cout << "Your average record is " << sum / times << endl;
// system("pause");
return 0;
}