Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Write a few lines of C++ which does the following: Output a statement to ask the user to input the numbers of innings
Question 1
Write a few lines of C++ which does the following:
- Output a statement to ask the user to input the numbers of innings today's pitcher pitched. Store the user's response in a variable numInnings of type int
- Output a statement to ask the user to input the numbers of runs today's pitcher gave up. Store the user's response in another variable numRuns of type int
- Calculate the pitcher's ERA using the following formula: ERA = numRuns * 9 / numInnings
- Output the ERA to the screen
Question 2
Write a few lines of C++ which does the following:
- Output a statement to ask the user to input the score for the home team today, and store the user's response in a variable homeScoreof type int
- Output a statement to ask the user to input the score for the visitor team today, and store the user's response in a variable visitorScore of type int
- Display the scores, and tell the user who won the game
- Also, tell the user if any of the following happened:
- One of the teams had a low score (<3)
- Both of the teams had a low score
- Use a const int for a low score instead of the magic number of 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started