Question: Write a program using both: functions and arrays with the following example: #include using namespace std; int main() { const int N = 4; double

Write a program using both: functions and arrays with the following example:

#include

using namespace std;

int main() { const int N = 4; double num[N]; double max; int p; for (int i = 0; i < N; i++) { cout << "value " << i + 1 << ": "; cin >> num[i]; } max = num[0]; p = 0;

for (int i = 1; i < N; i++) { if (num[i] > max) { max = num[i]; p = i; } } cout << "max value = " << max << endl; cout << "position in the array = " << p << endl;

system("pause"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!