Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a series of functions in C++ outside main, and utilize these functions by calling them from main(). The functions you must implement: 1. A

Write a series of functions in C++ outside main, and utilize these functions by calling them from main().

The functions you must implement:

1. A function that prints a simple text message on screen, such as "Hope you're having a good day". The signature for this function is: void printGreeting()

2. A function that accepts two floating point values as input (x and y), and prints the result of x/y. If the denominator (y) is zero, the function prints "Cannot perform division". Signature for this function: void divideNumbers(float x, float y)

3. A function that returns the factorial of an input integer value (num). If the input number is negative, the function returns 0. If the value is non-negative, the function computes the facorial and returns the value. Signature of this function: int factorial(int num)

4. A function that accepts a positive integer as input (N), and prints the first N terms of the Fibonacci series. For example, for an input of N = 10, the function prints "0, 1, 1, 2, 3, 5, 8, 13, 21, 34". Signature for this function: void fibonacci(int N)

[Final Step]: Once you have coded down these functions outside your main, go ahead and call these functions with meaningful parameters as input from within main(). If the function returns a value, capture and print that response in main.

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

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions