Control I - Learning Goals Department of Computer Science...

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

View Full Document Right Arrow Icon
1 Flow of Control Part Department of Computer Science APSC 160 Flow of Control Part I Learning Goals By the end of this section, you should be able to: • explain the term algorithm • explain, with an appropriate example, each of the following elements of an algorithm: sequence branching / selection looping / repetition • read and write an algorithm presented in the form of a flowchart Algorithm An algorithm is an unambiguous sequence of step-by-step instructions for solving a problem. Algorithms can be presented in more than one way. 1. Sift a cup of flour into a large bowl 2. Mix the yolk of three eggs until creamy 3. Melt 8oz chocolate in double boiler 4. … Flowchart General form of programs written so far in the course: Example:
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Example: #include <stdio.h> #define KMS_PER_MILE 1.6 int main( void ) { double miles; double kms; printf( "Enter miles: " ); scanf( "%lf", &miles ); kms = miles * KMS_PER_MILE; printf( "Kms: %f\n", kms ); return 0; } Sequence matters! Structured Programming
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/05/2010 for the course APSC 03293901 taught by Professor M.smith during the Fall '10 term at The University of British Columbia.

Page1 / 5

Control I - Learning Goals Department of Computer Science...

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

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