prg 410 week 3 assignment

3
PRG 410 WEEK 3 ASSIGNMENT To purchase this Click here: HTTP://WWW.ACTIVITYMODE.COM/PRODUCT/PRG-410-WEEK-3- ASSIGNMENT/ Contact us at: [email protected] PRG 410 WEEK 3 ASSIGNMENT C++ Programming I PRG-410 Assignment#3 Problem 1: [marks 20] Write a program that implements simple game scenario. Game has two-player or a three-player MODE. For each MODE you have to choose among four HEROs. These are ALPHA, BRAVO, CHALIE and DELTA. You have to design and implement proper notation for each MODE and implement them accordingly using appropriate conditions e.g., First player is selecting ALPHA then Second Player can’t select ALPHA. Against each MODE ask five values for each player if: • Ask input range is between (1-100) player will win with 10 points for one value. • Ask input range is between (101-200) player will win with 20 points for one value. • Ask input range is between (201-500) player will win with 50 points for one value.

Upload: johnmessi

Post on 27-Jan-2016

222 views

Category:

Documents


2 download

DESCRIPTION

PRG 410 WEEK 3 ASSIGNMENTTo purchase this Click here:HTTP://WWW.ACTIVITYMODE.COM/PRODUCT/PRG-410-WEEK-3-ASSIGNMENT/Contact us at:[email protected]

TRANSCRIPT

Page 1: Prg 410 Week 3 Assignment

PRG 410 WEEK 3 ASSIGNMENTTo purchase this Click here:

HTTP://WWW.ACTIVITYMODE.COM/PRODUCT/PRG-410-WEEK-3-

ASSIGNMENT/

Contact us at:

[email protected]

PRG 410 WEEK 3 ASSIGNMENT

C++ Programming I

PRG-410

Assignment#3

Problem 1: [marks 20]

Write a program that implements simple game scenario. Game has two-player or a three-player

MODE.

For each MODE you have to choose among four HEROs. These are ALPHA, BRAVO, CHALIE and

DELTA. You have to design and implement proper notation for each MODE and implement them

accordingly using appropriate conditions e.g., First player is selecting ALPHA then Second Player

can’t

select ALPHA.

Against each MODE ask five values for each player if:

• Ask input range is between (1-100) player will win with 10 points for one value.

• Ask input range is between (101-200) player will win with 20 points for one value.

• Ask input range is between (201-500) player will win with 50 points for one value.

Add all five values for HERO/HEROs and printout the winner of the game.

Problem 2: Rock, Paper, Scissors Game [marks 20]

Write a program that lets the user play the game of Rock, Paper, and Scissors against the computer.

The

program should work as follows.

1. When the program begins, a random number in the range of 1 through 3 is generated. If the

Page 2: Prg 410 Week 3 Assignment

number is

1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If

the

number is 3, then the computer has chosen scissors. (Don’t display the computers choice yet)

2. The user enters his or her choice of rock, paper, or scissors at the key-board. (Use a menu)

3. The computers choice is displayed.

4. A winner is selected according to the following rules:

• If one player chooses rock and the other player chooses scissors, then rockwins. (The rock

smashes the scissors.)

• If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors

cuts paper.)

• If one player chooses paper and the other player chooses rock, then paper wins. (Paper

wraps rock.)

• If both players make the same choice, the game must be played again to determine the

winner.

Problem 3: [marks 10]

Write a program to get the greatest common divisor of two integers. The greatest common divisor of

two

integers is the value that evenly divides each of the numbers. For example the even divisor of

integer 4

are: 1,2 and evenly divisors of integer 10 are: 1,2,5. So the greatest common divisor of these two

integers

is 2.

Problem 4: [marks 10]

Write a program by defining a function “power” to find and return the exponential power i.e.,

base^exponent. For example, if base = 2 and exponent = 3 then function should return 8.

Problem 5: TIC TAC TOE [marks 40]

Tic Tac Toe is a two player game with nine boxes having three rows and three columns. First player

one

makes his turn, which is followed by player two turn. Player one will fill the box with mark “X” and

player two mark with “O”. There will be nine turns in total and at any stage of game the player who

succeeds in placing three marks in a horizontal, vertical, or diagonal row wins the game.

You have to implement this game without using arrays. Implement proper checks according to the

Page 3: Prg 410 Week 3 Assignment

rules

of game. If a player mark at any position then that position cannot be accessed by any of the

players.

You can use internet to learn the rules of game.