You are to design a fight game between Neo versus Smith. The program needs to be organized using at least three functions. The specifications are as follows: 1. The program should display your name and your major. 2. The program should first call a password function. a. Request a password, multiple characters followed by return. b. For every character entered, display * character.
You are to design a fight game between Neo versus Smith. The program needs to be organized using at least three functions. The specifications are as follows: 1. The program should display your name and your major. 2. The program should first call a password function. a. Request a password, multiple characters followed by return. b. For every character entered, display * character.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please answer in C format
Expert Solution
Program Explaination
- Declare header files <stdio.h>, <stdlib.h>, <time.h> , <termios.h>, <unistd.h> and <string.h> for input/output operations, basic libraries like memory allocation, time operations, terminal I/o interface, constants of miscellaneous symbols and string operations respectively.
- Declare the functions to be used in the entire code.
- Declare main method
- Use current time to seed random number generator .
- Declare checkPassword() function
- Use while do condition to take user input for the password
- Use if loop to check the correct password
- Use while condition to check the characters in the password
- Use if-else loop to compare the strings within the password entered and correct password already mentioned in the code
- Declare startGame() void
- Initialize variables for Neo and Smith’s health
- Use for loop to store their random health values
- Check for knockout scenarios with if condition
- Use if else statement to check health after three rounds in no knockout condition
- Declare generateHealth() method
- Return random health values from 20 to 24.99 with rand() command
- Declare startRound method after which round 1 shall be started
- Use while loop to accept valid punches which is between 2 to 5
- Take user input for punches
- Calculate the damages for both Smith and Neo
- Calculate new health values for both the users
- Declare getRandomSkill() function
- Generate random skill value with rand() command
- Declare CheckKnockout() function with parameters of Neo’s and Smith’s health values
- Use if loop to check their knockout condition
- Declare getch() function
- Take user input and store in file memory.
Step by step
Solved in 3 steps with 3 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY