Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview For this daily, write a function named stats that will test three integer values to determine whether one or more conditions is true. A
Overview
For this daily, write a function named stats that will test three integer values to determine whether one or more
conditions is true.
A CPP file statscpp has been provided. It contains the prototype statement for the stats function, declaration
for six integer variables num num num randnum randnum and randnum code that will ask the
user to enter three values, and various calling statements for the stats function.
Add the stats function that is described below to the file. DO NOT change the code that is provided in int main
void stats int, int, int
The stats function tests three integer values to determine whether one or more of the following conditions is
true. The conditions to test are:
the first and second numbers are both even.
the first number is less than both the second and the third.
the second or the third number is odd.
either the first or the second numbers are less than the third.
The stats function takes three integer arguments: the three integer values to use in the tests. It returns nothing.
Using the three passed in integers, check the four conditions, and for each condition that is true, print the
corresponding test number followed by a space character.
Print a new line at the beginning and end of the output produced by the function.
For example, if the passed in values are and the function should display:
since and are both even condition is less than both and condition and or is less than
condition Condition fails because neither nor is odd.
Use the following code to start writing the c program: Compound Relational daily
#include
#include
#include
using namespace std;
function prototype
void statsint int, int;
const int STARTTEST ;
const int NUMTESTS ;
int main
int num num num;
int randnum randnum randnum;
int seedvalue;
Get three numbers to test
cout "What is the first number? ;
cin num;
cout "What is the second number? ;
cin num;
cout "What is the third number? ;
cin num;
cout endl "What is the seed value for the random number generator? ;
cin seedvalue;
Test the function with user input
cout endl "Test : check the stats on the numbers: num num and num endl;
statsnum num num;
Test the function with known values
cout endl "Test : check the stats on the numbers: and endl;
stats;
cout endl "Test : check the stats on the numbers: and endl;
stats;
cout endl "Test : check the stats on the numbers: and endl;
stats;
test the function with random values
seed the random number generator with a value of
srandseedvalue;
conduct the extra tests with the random numbers
forint testNum STARTTEST; testNum STARTTEST NUMTESTS; testNum
generate the three random numbers that will be used by the test
randnum rand;
randnum rand;
randnum rand;
display the heading for the test, including the random n umbers
cout endl "Test testNum : check the stats on the numbers:
randnum randnum and randnum endl;
determine the stats for the random numbers
statsrandnum randnum randnum;
return ;
Code the stats function below this line
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