Question
in C++ Extract and Add a Series of Numbers: Write a program that will extract a series of numbers (type double) from an input sentence
in C++
Extract and Add a Series of Numbers: Write a program that will extract a series of numbers (type double) from an input sentence and then add them. EXAMPLE: Suppose the sentence entered is Give me the sum of 25.25 and 13.50. The program should print to the screen: The sum = 38.75 NOTE: The numbers can be of any value. Dont hard code to the values shown in the example. In this problem take advantage of the input options presented in class. Particularly cin, cin.get, cin.ignore, and peek. The functions in Appendix C.2 may also be helpful.
Test the program with both of these examples:
TEST CASE 1. Please tell me the sum of 18.0 plus 25.5. OUTPUT: "The sum is 43.5 TEST CASE 2. If I add 24.5, 18.0 and 17.2 what do I get? OUTPUT: "The sum is 59.7
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