Break This Combination

From CompSciWiki
Revision as of 15:22, 5 April 2010 by JesseV (Talk | contribs)

Jump to: navigation, search

Back to the Program-A-Day homepage

Problem

In this sample problem, we will design a program that can determine the sequence of a combination lock, and keep track of the number of attempts until the combination is broken.

The program will begin by prompting the user to configure their combination lock. The user will then enter in THREE numbers ranging from 0 to num_possibilities (in this example, we will assume num_possibilities to be 59, but you may change this within the source code to a larger or smaller number if you like). We will store each number within an integer array of size 3 since there are three numbers we need to select in sequence in order to break the lock.

After the lock has been configured, the program will then proceed in attempting to break the lock. After every attempt, the program should increment a counter, num_attempts, until the lock has been broken.

 

SideSectionTitle

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

Write solution here...

Code

SolutionCode goes here. Please DO NOT put your code in <pre> tags!

Back to the Program-A-Day homepage