ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 23 May 2017 My Price 8.00

SumAndProduct.cpp - This program computes sums and products

My problem is to complete a partially written C++ program that includes two functions that require a single parameter.  The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a function that computes the sum of all the whole numbers from 1 up to and including the entered number. next the program passes the value to another function that computes the product of all the whole numbers up to and including the entered number.  here is my code.  I am trying to just call the function sums and no matter what I put in () I get an error when compiling I am trying to work in steps but can't get pass the first part.  Following my book it seems like I am trying the right things but to no avail. 

// SumAndProduct.cpp - This program computes sums and products 
// Input:  Interactive
// Output:  Computed sum and product

#include <iostream>
#include <string>
int number1, number2;
void sums(int);//function declaration
void products(int);//function declaration
using namespace std;

int main() 
{
   double number;               
         
   cout << "Enter a positive integer or 0 to quit: ";
   cin >> number;

   while(number != 0)
   {  
      // Call sums function here 
      sums(number);
      
    
      // Call products function here
     // products(int);
      
   }
   return 0;
} // End of main function
 
// Write sums function here
//void sums(int number1, int number2)
//{
       //if number1
//sums = number1 + number2

// Write products function here
//products(int number1, int number2)
//Declarations
//int total
//products = number1 * number2

Answers

(11)
Status NEW Posted 23 May 2017 08:05 AM My Price 8.00

-----------

Not Rated(0)