C++
x
42
1
2
using namespace std;
3
4
void entry(double arry[],int size);
5
6
//Additional function prototype when needed
7
void displayEntry(double dtAry[],int sz) ;
8
9
int main()
10
{
11
int size = 6;
12
13
double values[6];
14
cout << "Data Analysis" << endl;
15
cout << "=============" << endl<<endl;
16
entry(values, 6);// Call function to allow user to enter the readings
17
// Additional function calls when needed
18
19
20
21
return 0;
22
}
23
// Your function implementaiton here
24
void entry(double arry[],int size)
25
{
26
int i;
27
for(i=0;i<size;i++)
28
{
29
cout << "Enter Reading " << i+1 << ": ";
30
cin>> arry[i];
31
}
32
return;
33
}
34
void displayEntry(double dtAry[],int sz)
35
{
36
cout <<"You have entered the following readings: ";
37
for(int i=0;i<sz-1;i++)
38
{
39
cout << dtAry[i] <<", ";
40
}
41
}
42
$ g++ prog.cc -Wall -Wextra -std=c++98 -pedantic
Stdin
1 2 3 4 5 6
Start
prog.cc: In function 'int main()': prog.cc:11:5: warning: unused variable 'size' [-Wunused-variable] 11 | int size = 6; | ^~~~
Data Analysis ============= Enter Reading 1: Enter Reading 2: Enter Reading 3: Enter Reading 4: Enter Reading 5: Enter Reading 6:
0
Finish