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

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
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); }
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/27/2010 for the course ENG ECOR taught by Professor N/a during the Spring '10 term at Carleton CA.

Page1 / 3

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online