Question: PROGRAM 6 : Match Game Write a program that reads a match number and then a list of numbers from a user. The program should
PROGRAM : Match Game
Write a program that reads a match number and then a list of numbers from a user. The program should end when the number entered exactly equals the match number or exceeds it Once the game ends, display the total number of positive and negative numbers entered as well as the longest consecutive streak of similarly signed quantities. Shown below is a sample program dialogue.
Shown below are sample program dialogues to help you build your program.
Gimme a goal number:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
You Hit The Match!
You Fed Me: positive quantities and negative quantities
Longest Positive Streak Of Quantities:
Longest Negative Streak Of Quantities:
Gimme a goal number:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
Feed Me:
You Missed The Match!
You Fed Me: positive quantities and negative quantities
Longest Positive Streak Of Quantities:
Longest Negative Streak Of Quantities:
Hint: This program is pretty complex with many different conditions to keep track of I would recommend you write it first in C or Visual Basic and then translate your lines of code, onebyone, into a assembly statements, just like our good friend mr compiler does
Additional Hint: You should not be using high language statements like for, while or repeat loops, as these are not assembly instructions are off limits in this course.
Without using high level programming such as loops and if statements.
Here is my c code that works but want to convert to HLA assembly
#include
int main
int goal, number;
int positiveCount negativeCount ;
int longestPositiveStreak longestNegativeStreak ;
int currentPositiveStreak currentNegativeStreak ;
int hitMatch ;
printfGimme a goal number: ;
scanfd &goal;
while
printfFeed Me: ;
scanfd &number;
Check if the game should end
if number goal
hitMatch ;
break;
else if number goal
break;
Count positive and negative numbers
if number
positiveCount;
currentPositiveStreak;
currentNegativeStreak ;
if currentPositiveStreak longestPositiveStreak
longestPositiveStreak currentPositiveStreak;
else if number
negativeCount;
currentNegativeStreak;
currentPositiveStreak ;
if currentNegativeStreak longestNegativeStreak
longestNegativeStreak currentNegativeStreak;
else
Reset streaks on zero input
currentPositiveStreak ;
currentNegativeStreak ;
if hitMatch
printfYou Hit The Match!
;
else
printfYou Missed The Match!
;
printfYou Fed Me: d positive quantities and d negative quantities
positiveCount, negativeCount;
printfLongest Positive Streak Of Quantities: d
longestPositiveStreak;
printfLongest Negative Streak Of Quantities: d
longestNegativeStreak;
return ;
Without using high level programming such as loops and if statements.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
