Example Algorithms
The following are some example algorithms for problems (see also the first program in the demo
folder in the General Material Module).
Example 1: Suppose you were asked to calculate the area of a triangle.
Purpose: Calculate the area of
Algorithm 1
CMPSC 201
Due as stated on CANVAS
Create a NOTEPAD or PDF file that restates the problem in your own words, specifies what
input is needed from whomever is using the process, what output is expected, the step by step
process (algorithm) to get
CMPSC 201 Fall 2016
Lab 2
To be done individually
Due by end of your recitation section on 9/9/16.
Goals: Practicing variable definitions (declarations) and arithmetic operations.
Implement one of the 3 problems given the Algorithms 1 assignment into C+.
1. Purpose: To determine the force between two bodies using the formula F= (G * M1 * M2) / d *
d where G is the gravitational constant 6.673 * 10 ^ -11
Input : the masses of the bodies and the distance between them
Output: The force acting between the bod
1. Purpose: To determine how many cases company XYZ would produce with the same number
of candy bars produced by company ABC
Input needed: Number of cases produced by company ABC
Output expected: Number of cases produced by company XYZ with that same numb