I mean, I have 2 separate functions that I want to combine...
So you've said. You also said you're getting errors, but you declined to provide them.
So, when you get errors you look at the first one the compiler gives you. You correct it. You try again to recompile. If more errors are generated, you look at the first error the compiler gives you. You correct it. Repeat until no errors are generated.
If you have questions about a specific error as it relates to your code, ask a question including the code in question and the exact text of the error message. "I have errors help~!" doesn't help anyone help you.
int main ()
{
// Function 1 random number from 11 to 23 inclusive
srand((int)time(NULL));
cout << randomNumber(11, 23) << '\n';
// Function 2 finds the biggest number of 3 values
float largest = biggestNumber(1.2,2.1,3.7);
cout << "Largest is " << largest << endl;
// Function 1 return
float val2 = 0; // <--
float val1 = 0; // <--
return rand()%(val2 - val1 + 1) + val1;
return 0;
}
#include <iostream>
#include <time.h>
#include <stdlib.h>
usingnamespace std;
// Function 1
int randomNumber(int val1, int val2); // Function 1 prototype
// Function 2
float biggestNumber(float num1, float num2 , float num3 ); // Function 2 prototype
int main ()
{
// Function 1 random number from 11 to 23 inclusive
srand((int)time(NULL));
cout << randomNumber(11, 23) << '\n';
// Function 2 finds the biggest number of 3 values
float largest = biggestNumber(1.2,2.1,3.7);
cout << "Largest is " << largest << endl;
// Function 1 return
return rand()%(val2 - val1 + 1) + val1;
return 0;
}
int randomNumber(int val1, int val2) // Function 1 definition
float biggestNumber(float num1, float num2, float num3) // Function 2 definition
{
// Function 2 return
float max = 0;
if (num1 > max)
max = num1;
if (num2 > max)
max = num2;
if (num3 > max)
max = num3;
return max;
}
> Write a VOID function which takes THREE float PARAMETERS : num1, num2 and num3.
The function displays the largest number.
That is the question of the assignment.
But unfortunately, it just seems no one has ever noticed that yet.