can someone help me with this project please? write a program that has 2 different void functions, 2 functions that return numerical values, 1 function that returns a Boolean value, 1 decision structure based on function return value, 1 loop structure based on function return value. the topic can be anything. please help asap!
Here's the basic template. Feel free to change the function names as necessary. You will have to choose a topic yourself and decide what each function should do.
void function1() // Add any necessary parameters
{
// Do something
}
void function2() // Add any necessary parameters
{
// Do something
}
int returnInteger() // Add any necessary parameters
{
// Do something and return value
}
double returnDouble() // Add any necessary parameters
{
// Do something and return value
}
bool returnBool() // Add any necessary parameters
{
// Do something and return value
}
int main()
{
// Write your code
return 0;
}
Make a calculator that does 2 things. Get the factors of a number and does division. The 2 void functions will call the factor function or the division function. 2 functions that return numerical values will be the division and factor function. The boolean function will decide if the user wants to divide or get the factors of a number. The decision structure will check if the user wants to divide or get factors from the boolean function. The loop structure will be getting the factors by dividing the number the user inputted by repeatedly smaller numbers while user input number stays the same. Hint: Use modulo operator to show only the factors from the division done. Your wlecome!!! :)
void callDivisionFunction()
{
// Call division function
}
void callFactorFunction()
{
// Call factor function
}
int divisionFunction()
{
return dividend / divisor;
}
int factorFunction()
{
/* Divides the input number by itself - 1 but input number stays the same and use the modulo operator to not show every division result but only the whole numbers of the results */
}
bool divideOrFactors()
{
/* User enter 1 for division and 2 for getting factors */
}
/*
*** Call above functions in main() as necessary!
*/
int main()
{
/* Get user input to decide division or factors. This will be decision structure */
/* Loop structure with factor function inside so it gets divided repeatedly by smaller numbers */
}