{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

10-QualityProgramming

# 10-QualityProgramming - quality programming think...

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

quality programming think everything thru

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

View Full Document
initializing arrays, switch, short, long, break, continue, return = functions( );
init arrays int z[5] = { 0, 0, 0, 0, 0}; string names [3] = {“gary”, “frank”, “sue”};

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

View Full Document
break // leaves a loop while (true ) { if (x == 0) { break; } // goes to here }
continue // continues a loop while ( true ) { // goes to here if (x == 0) { continue; } }

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

View Full Document
an example char userInput = ' '; // init to a blank while (true ) { cout << "Type q to quit: "; cin >> userInput; if (userInput == 'q') { break; } // end if else { cout << "Keep going" << endl; continue; } // end else } // end while
instead of ifs, else if, etc.. int x; switch (x ) { case( 0 ): { // code break; } case( 1 ): { // code break; } case( 2 ): { // code break; } default: { // code break; } } // end switch

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

View Full Document
computers store numbers in memory … memory is not unlimited double : 10.4 : has two parts to be stored int : 14 : has one part short x; : x is a small integer number long x; : x is a large integer number int x; : ?
let's test it short Factorial = 1; // Factorial gets big fast for ( int z=1; z<=10; z=z+1 ) { Factorial = Factorial * z; cout<< z << " " << Factorial << endl; } // end while;

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

View Full Document
when numbers get too big, they go negative short x=0, y=0; start:
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 19

10-QualityProgramming - quality programming think...

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

View Full Document
Ask a homework question - tutors are online