Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objectives Assignment #7 Introduction to C Programming COP 3223 Problem: Codebreaking! (codebreaker.c) You are almost ready to graduate from the Ninja Academy. Only one set

Objectives

Assignment #7 Introduction to C Programming COP 3223

Problem: Codebreaking! (codebreaker.c)

You are almost ready to graduate from the Ninja Academy. Only one set of lessons remains: code breaking. You will need to learn how to break numerical codes of varying lengths and difficulties.

The basic idea is this:

1) You begin by selecting a length and difficulty for the code. A set of numbers will be generated.

2) You will guess the magnitude and placement of each of the numbers.

3) Anything exactly correct will be revealed.

4) Anything with the correct value will be noted, but not revealed.

5) You can guess as many times as you want.

When the correct code is entered, the program will end.

A scaffold for this program has been provided below. You must fill in the eight functions that are currently empty. After you write each function, you should test it before moving on. The main function should not be modified for the final submission (you may modify it during testing, as long as you return it to its initial form). Descriptions of each function are given in the scaffold along with the function Pre- and Post-conditions. The output samples at the end of this document show the wording you should use and how the program should run when completed. Also, make sure you include comments throughout your code describing the major steps in solving the problem.

Your programs will be graded upon the following criteria:

1) Your correctness

2) Your programming style and use of white space. Even if you have a plan and your program works perfectly, if your programming style is poor or your use of white space is poor, you could get 10% or 15% deducted from your grade.

3) Compatibility You must submit C source files that can be compiled and executed in a standard C Development Environment. If your program does not compile, you will get a sizable deduction from your grade.

Output Sample #2 Welcome to Codebreaker Training! You will be presented with a set of hidden values. Your job is to guess these values and their correct order. After each guess you will be given feedback.

Values that are correct in magnitude and in the correct location will be revealed. These are perfect matches.

Thenyouwillbetoldhowmanyothernumbersarecorrectinmagnitudeonly. Theseareimperfect matches. No additional information will be revealed.

Choose a length for the code (5-10 numbers).

3

Choose a length for the code (5-10 numbers).

11

Choose a length for the code (5-10 numbers).

5

Choose a difficulty (1, 2, or 3).

0

Choose a difficulty (1, 2, or 3).

5

Choose a difficulty (1, 2, or 3).

3

There are 5 numbers ranging from 1 to 9.

------------ Enter your guess: 12345 You have 2 perfect matches and 1 imperfect matches.

12--- Enter your guess: 12434 You have 3 perfect matches and 0 imperfect matches.

124-- Enter your guess: 12467 You have 3 perfect matches and 1 imperfect matches.

124-- Enter your guess: 12476 You have 4 perfect matches and 0 imperfect matches.

124-6

Enter your guess: 12486

You have 4 perfect matches and 0 imperfect matches.

124-6 Enter your guess: 12496 You have 5 perfect matches and 0 imperfect matches.

Congratulations! You guessed all the values!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

1. Communicating courses and programs to employees.

Answered: 1 week ago

Question

6. Testing equipment that will be used in instruction.

Answered: 1 week ago