{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Control I

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

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

1 Flow of Control Part I Department of Computer Science APSC 160 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:

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

View Full Document
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!
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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
Ask a homework question - tutors are online