Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Assignment1A: Math Mad Libs: In traditional Mad Libs, youre given a paragraph of text with blanks; you then fill in those blanks to create

C++

image text in transcribed

Assignment1A: Math Mad Libs: In traditional Mad Libs, youre given a paragraph of text with blanks; you then fill in those blanks to create an amusing or silly story. In this program, we will do the same thing - but with numbers! You will print out the following equation as a string literal: x + (y/z) *w = ? You will then prompt the user to enter one number at a time, replacing the variables from left to write with those numbers and printing the updated string to the screen. After the last number is entered, you will print the full equation with the solution replacing the ? question mark. A sample output from this program is as shown below, with user input in bold. Your program's output must match this format, but it should work for any valid user input. Save your source code in a file called Assignment1A (with a file extension of .cpp, .cs or .java) Sample Output: [Math Mad Libs] x + (y / z) * W = ? Enter the first term: 3 3 + (y / z) * W = ? Enter the second term: 4.3 3 + (4.3 / z) * W = ? Enter the third term: -2 3 + (4.3 / -2) * W = ? Enter the fourth term: 7.8 3+ (4.3 / -2) * 7.8 = -13.77 Note: Use a floating point variable to store each value entered by the user. Depending on your programming language, you may or may not have a decimal value displayed when entering a whole number (for instance, entering 5 may print out 5.0). Both formats are acceptable for this assignment. Also, you can assume the user will not input O for the third term. We will learn how to handle logical issues like this a little later in the course

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions