Create a boolean function that computes

Assignment Help C/C++ Programming
Reference no: EM13166806

Create a Boolean function that computes the value of a factorial for values up to including 10. Include comments about how to use the function and describing how it works.

The first parameter is the integer (int) for which you are calculating the factorial.

The second parameter is an integer (int) that must be passed by reference. Use the passed by reference parameter to return the result of the factorial operation.

Before you attempt to compute the factorial make sure that first parameter is a valid number for performing a factorial.

If the first parameter is not a valid number the function must return false.

If the first parameter is a valid number the number must return true and must return the factorial value in the second parameter as described above.

Create a void test function that is to be called from your main function.

In this test function call your factorial function several times using both valid and invalid values for the requested factorial. Be sure to cover all values that are just inside or outside the limits.

Do not use cin to obtain input from the user.

Write several calls to your factorial function. Be sure to capture and check the value of the bool returned by your function in every case.

Use cout to display a failure message on failures (include the invalid attempted factorial).

Use cout to display a success message on success. Include the requested factorial and the computed factorial value.

I only got to bool and I don't get the rest...

#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;

bool ComputeFactorial(int first, int second);
void FactorialFunction()
{
  
}


bool ComputeFactorial(int first, int &second)
{
   {
       if (first > 0 && first <= 10)
       {
           second = 1;
           int n;
           for (n = 1; n <= first; n++)
           {
               second = second * n;
           }
           return true;
       }
          
       else
           return false;
   }
}


int _tmain(int argc, _TCHAR* argv[])
{
   FactorialFunction();
   system("pause");
   return 0;
}

Reference no: EM13166806

Questions Cloud

What is the mole fraction of ethanol in a solution : What is the mole fraction of ethanol in a solution made from mixing 299 grams of ethanol (C2H5OH) and 360 grams of water? (Round your answer to 2 places after the decimal.)
How to design a new isa : How to design a new ISA? What should take into consideration?
Design and implement an avl tree algorithm : Design and implement an AVL tree algorithm that searches a collection of documents. You will be provided with a set of 50 documents and a set of sample queries. First, you will process the documents and store their content (i.e. words / tokens) in..
A program computes and displays the number of centimeter : The Earth's ocean levels have risen an average of 1.8 millimeters per year over the past century. Write a program computes and displays the number of centimeters and number of inches the oceans rose during this time.
Create a boolean function that computes : Create a Boolean function that computes the value of a factorial for values up to including 10. Include comments about how to use the function and describing how it works.
Several views to cybersecurity architecture : several views to Cybersecurity Architecture. Describe the Business View and the Architect's View through a business case example.
Describe what is meant by cybersecurity design : Describe what is meant by Cybersecurity Design.List and describe the principles that must be supported.
Create a program that contains 4 methods : Create a program that contains 4 methods / functions... main(), getTestScores(), calcAverage(), and displayAverage(). The main() method should call the getTestScores() method to get and return each of 3 test scores.
Describe what is meant by cybersecurity architecture : Describe what is meant by Cybersecurity Architecture. List and describe the principles that must be supported.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd