{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Problem 38

# Problem 38 - ECOR1606 Problem Solving and Computers Page 1...

This preview shows pages 1–3. Sign up to view the full content.

ECOR1606 – Problem Solving and Computers Page 1 of 3 Department of Systems and Computer Engineering Carleton University P ROGRAM O UTPUTS Background information This lab is intended to be done on paper and help enable you to evaluate your understanding of basic programming. For the following programs, determine what the output display will be. Note you can easily check your answer by running the program Program #1 #include <iostream.h> const int ARRAY_SIZE = 5; void display_array(int x[], const int N); void main(void) { int y[ARRAY_SIZE], i; for (i = 0; i < ARRAY_SIZE; i++) { y[i] = i%3; display_array(y,i+1); } } void display_array(int x[], const int N) { int i; for (i = 0; i < N; i++) { cout << x[i] << " "; } cout << endl; } Program #2 #include <iostream.h> const int ARRAY_SIZE = 10; void display_array(int x[], const int N); void main(void) { int y[ARRAY_SIZE], i; for (i = ARRAY_SIZE-1; i >= 0; i--) { y[i] = i%5; } display_array(y, ARRAY_SIZE); }

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
ECOR1606 – Problem Solving and Computers Page 2 of 3 Department of Systems and Computer Engineering Carleton University void display_array(int x[], const int N) { int i;
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

Problem 38 - ECOR1606 Problem Solving and Computers Page 1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online