Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Copy the main given below and add what the directions tell you to edit main to Copy #include using namespace std; // Put prototype here

Copy the main given below and add what the directions tell you to edit main to Copy

#include using namespace std; // Put prototype here int main() { int startValue; int stopValue; int answer; char again; do { cout << "Enter the start value: "; cin >> startValue; cout << "Enter the stop value: "; cin >> stopValue; // Call the function summation (after you write it) // and store the value returned into the variable answer // declared above // You can assume that start value is less than or equal // to stop value // The description of the function is given below // Don't forget to put prototype at top cout << "The summation from " << startValue << " to " << stopValue << " is " << answer << endl; cout << "Do you want to find another summation (y/n): "; cin >> again; } while (again == 'y' || again == 'Y'); return 0; } // Write function called summation. The function will have // 2 formal parameters. The first formal parameter is the start // value and the second formal parameter is the stop value. // You can assume start value is less than or equal to stop value // The method will find the summation from the first value // to the stop value and return the answer // for example, if start value is 2 and stop value is 5, the // program will return the value 14 (2 + 3 + 4 + 5) 

Sample Output

Enter the start value: 2 Enter the stop value: 5 The summation from 2 to 5 is 14 Do you want to find another summation (y/n): y Enter the start value: -3 Enter the stop value: 15 The summation from -3 to 15 is 114 Do you want to find another summation (y/n): Y Enter the start value: 3 Enter the stop value: 12 The summation from 3 to 12 is 75 Do you want to find another summation (y/n): n

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

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions