What is the Output Exercises Chapter 02

What is the Output Exercises Chapter 02 - What is the...

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

View Full Document Right Arrow Icon
What is the Output Exercices Chapter 02 1 1. What is the output of the following program ? #include <iostream.h> void main () { int x = 1; for ( ; ; ) { if ((x++ % 15) == 0) break ; if ((x % 5) != 0) continue ; cout << x << " "; } cout << endl; } Answer : If we had: if ((++x % 15) == 0) then the answer would be:
Background image of page 1

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

View Full DocumentRight Arrow Icon
What is the Output Exercices Chapter 02 2 2. What is the output of the following program ? #include <iostream.h> void main () { int x = 10; while ( x ) { if ( --x == 5 ) break ; cout << x << " "; } cout << endl; } Answer : If we had: if (x-- == 5) then the answer would be:
Background image of page 2
What is the Output Exercices Chapter 02 3 3. What is the output of the following program ? #include <iostream.h> void main () { int x = 10; while ( x ) { cout << --x << " "; } cout << endl; } Answer : If we had: cout << x-- << " "; then the answer would be:
Background image of page 3

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

View Full DocumentRight Arrow Icon
What is the Output Exercices Chapter 02 4 4. What is the output of the following program ? #include
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/27/2010 for the course DS csc 270 taught by Professor Dr.m.g during the Spring '10 term at Notre Dame University-Louaize.

Page1 / 10

What is the Output Exercises Chapter 02 - What is the...

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

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