Question
Using C++, implement functions that do each of the following. Function names and examples are included after //. count_odds will return the number of odd
Using C++, implement functions that do each of the following. Function names and examples are included after //.
count_odds will return the number of odd numbers between arguments a and b (inclusive). a is guaranteed to be less than b.
// for example, count_odds(4, 11) returns 4, because there are four
// odd numbers (5, 7, 9, 11) between 4 and 11 inclusive.
//int count_odds(int a, int b);
is_prime returns true if n is a prime number; false otherwise. For the purposes of this function and homework assignment, n will be less than 1000.
//bool is_prime(int n);
quadratic computes the value of ax^2 + bx + c and returns it.
//
// for example, quadratic(3, 7, 4, 2) returns
// (3*(2^2)) + (7*2) + 4
// == 12 + 14 + 4 == 30
//float quadratic(float a, float b, float c, float x);
ftol returns true if a is strictly within tol units of b. tol is guaranteed to be positive.
//
// For example, ftol(14.001, 14.0, 0.00001) returns false because
// 14.001 is not in the range (14.0 - 0.00001, 14.0 + 0.00001).
//
// But ftol(10.0, 11.0, 2.0) returns true because 10 is in the range
// (11-2, 11+2).
//bool ftol(float a, float b, float tol);
is_bleep returns true if the input number n is divisible by 3 or 7, or if it is between 10 and 20 exclusive. It returns false otherwise.
//bool is_bleep(int n);
is_blop returns true if the input number n is divisible by 4, or if it is larger than 35 and divisble by 5.
//bool is_blop(int n);
is_bleebleblam returns true if the input number is both bleep and blop (as determined by is_bleep and is_blop).
//bool is_bleebleblam(int n);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started