Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Working with zylabs Some background on the zyLabs programming environment. Between submissions, the zyLab system does not save your work. For example, if you write

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Working with zylabs Some background on the zyLabs programming environment. Between submissions, the zyLab system does not save your work. For example, if you write your program and then close the browser, when you come back your program will be gone. For this reason, save your work in a separate document using an editor or word processor. Each time you submit your work is saved, but nothing is saved until the first submission, and nothing is saved between submissions. If your program is not working, switch to "Develop mode", add some output / debugging statements, and run.... 301246.1517390 LAB ACTIVITY 7.1.1: Programming: array average 0 / 50 Current file: util.cpp Load default template... 1 V 2 // avg 3 // 4 // given an array A of size N, returns the average of the contents. 5 // if N is o, return 0.0. 6 // 7 double avg(double A[], int N) 8 { 9 return -1.0; 10 } 11 1 Type here to search O EI > 1:57 PM 1/30/2021 O Working with zylabs Some background on the zyLabs programming environment. Between submissions, the zyLab system does not save your work. For example, if you write your program and then close the browser, when you come back your program will be gone. For this reason, save your work in a separate document using an editor or word processor. Each time you submit your work is saved, but nothing is saved until the first submission, and nothing is saved between submissions. If your program is not working, switch to "Develop mode", add some output / debugging statements, and run..... 301246.1517390 LAB ACTIVITY 7.1.1: Programming: array average 0 / 50 File is marked as read only Current file: main.cpp // output: // output(A, N); // // avg: // double result; 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 } 53 result = avg(A, N); cout 1:56 PM 1/30/2021 = Working with zylabs Some background on the zyLabs programming environment. Between submissions, the zyLab system does not save your work. For example, if you write your program and then close the browser, when you come back your program will be gone. For this reason, save your work in a separate document using an editor or word processor. Each time you submit your work is saved, but nothing is saved until the first submission, and nothing is saved between submissions. If your program is not working, switch to "Develop mode", add some output / debugging statements, and run.... 301246.1517390 LAB ACTIVITY 7.1.1: Programming: array average 0 / 50 File is marked as read only Current file: main.cpp cout > mode; 2 3 using namespace std; 4 5 6 double avg(double A[], int N); // defined in "util.cpp" 7 8 void fill(double A[], int n, int mode); 9 void output(double A[], int N); 10 11 int main() 12 { 13 int mode; 14 int N; // array size 15 double* A; // pointer to first element of the array 16 17 cout > N; 19 20 cout 1:56 PM 1/30/2021 a 7.1 Programming: array average Write a function avg that takes an array A of real numbers and its size N and returns the average of the array elements. Because division by O is not defined, the function should return 0 if N = 0. Note that the main program is written for you, and cannot be modified. Your job is to write the function avg defined in "util.cpp"; you select this file from the drop-down list above the editing window. You can test in "Develop mode" by clicking "Run my program", clicking anywhere in the terminal window, and then entering an array size. The main program will generate a series of random numbers and then call your function. When you are ready to submit, switch to "Submit mode" and click "Submit for Grading". You have unlimited submissions; the system records your highest score across all submissions. # Working with zylabs Some background on the zyLabs programming environment. Between submissions, the zyLab system does not save your work. For example, if you write your program and then close the browser, when you come back your program will be gone. For this reason, save your work in a separate document using an editor or word processor. Each time you submit your work is saved, but nothing is saved until the first submission, and nothing is saved between submissions. If your program is not working, switch to "Develop mode", add some output / debugging statements, and run.... 301246.1517390 LAB ACTIVITY 7.1.1: Programming: array average 0 / 50 File is marked as read only Current file: main.cpp 1 Type here to search O > 1:56 PM 1/30/2021 TS

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions