
Please complete the following function getMax, which accepts three integer parameters (int p, int q, int r), and must return the maximum of those 3 integers received to the caller.
THIS IS ALL I HAVE SO FAR. AREAS MARKED WITH ":::::::" is where I need help. Thank you!
int getMax(int p, int q, int r) // returns the max of 3 integers
{ // begin getMax()
:::::::: NEED HELP HERE ::::::::
} // end getMax()
void main( ) // To test function getMax( )
{ cout << "Data: 9 18 4 , Max = " << getMax(9, 18, 4) << endl;
cout << "Data: 99 18 4 , Max = " << getMax(99, 18, 4) << endl;
cout << "Data: 9 18 49 , Max = " << getMax(9, 18, 49) << endl;
}
The output of the above program should be as follows:
Data: 9 18 4 , Max = 18
Data: 99 18 4 , Max = 99
Data: 9 18 49 , Max = 49

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

- <These are JavaScript Questions> Q4: Create a function that multiply's two numbers together and outputs the answer. The function must accept 2 parameters. Don't forget about SCOPE if you're using varibles inside of your function. Q5: Using your multiply function, use the shortest amount of code to display the following output on the screen: 1 * 1 = 1 2 * 2 = 4 3 * 3 = 9 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36 7 * 7 = 49 8 * 8 = 64 9 * 9 = 81 10 * 10 = 100 Q6: Determine using a conditional statement, if the following variable is a number or is not not a number. If it is not, try to convert it to a number and use your mult() function to multiply it by 2. NOTE: YOU MAY NOT MODIFY ANY VARIBLES that are Constants. const number = "17";arrow_forwardWrite a function that accomplishes the following: Accepts a list of floats as a parameter. Prints out the list and ensure the floats are printed in a well formatted fashion. See the example below. (Negative monetary values are usually shown with parentheses in spreadsheets and other financial software.) Format the data so that values with four digits for dollars and two digits for cents can be lined up. 5.22 $ $ ( 10.01) $ 0.05 $ ( 1.01) $ 7.42 $ ( 10.50) $ 5000.10 $ (2010.20) Test the function by providing a list as an argument that has initialized the floats to the Well-Behaved Data Examples given above.arrow_forwardPython question please include all steps and screenshot of code. Also please provide a docstring, and comments throughout the code, and test the given examples below. Thanks. In written text small numbers are often written out, e.g. you'd write 'I have twobrothers and one sister', rather than 'I have 2 brothers and 1 sister'. In this problem youwill implement a function convertSmall() that takes as input a text (i.e., string) s andreturns the text s with small numbers (integers between 0 and 6) converted to their names.>>> convertSmall('I have 2 brothers and 1 sister')'I have two brothers and one sister'>>> convertSmall('I have 8 brothers and 5 sisters')'I have 8 brothers and five sisters'arrow_forward
- Which of the following function declarations are illegal? void t1(int x, int y = 0, int z);void t2(int x = 0, int y = 0, int z);void t3(int x, int y = 0, int z = 0);void t4(int x = 0, int y = 0, int z = 0);arrow_forwardCould you solve this Question please? Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False. Implement has_duplicates by creating a histogram using the histogram function above. Do not use any of the implementations of has_duplicates that are given in your textbook. Instead, your implementation should use the counts in the histogram to decide if there are any duplicates. Write a loop over the strings in the provided test_dups list. Print each string in the list and whether or not it has any duplicates based on the return value of has_duplicates for that string. For example, the output for "aaa" and "abc" would be the following. aaa has duplicatesabc has no duplicates Print a line like one of the above for each of the strings in test_dups. Obs:Copy the code below into your program def histogram(s): d = dict() for c in s: if c not in d: d[c] =…arrow_forwardAlert dont submit AI generated answer.arrow_forward
- Write a full program that display the area of a rectangle. The program calls the following two functions: • getLengthWidth – This function uses a reference parameter variables to accept an int arguments length and width. This function should ask the user to enter the rectangle’s length and width. Input validation: length and width should be positive integers. • calArea – This function should accept the rectangle’s length and width as arguments and return the rectangle’s area. The area is calculated by multiplying the (length * width).arrow_forwardOver the years, people have created a few nicknames for me. One that sticks without me telling me to call me that name is "Denck." It works great with anyone whose name ends with an "er". We are going to create a function called "nickName" which takes in one parameter. This parameter stores the name you want to create the nickname for. If the name ends with an er, return the name with the er removed. If the name does not have an er then return the full name back to the program.arrow_forwarda. Write a function called IsPalindrome that receives a 3-digit number and returns whether it is palindrome or not. b. Write a function, called GCD that receives two parameters n, d, and prints their greatest common divisor a. Now after you created the two functions, you have to write a main function that can call the above functions according to user choice. Write a menu that allows the user to select from the following options 1. To use the IsPalindrome function you have to enter 1. 2. To use the GCD function you have to enter 2. 3. To Exit the program you have to enter 3. [use exit(0)] Once the user select one of the above choices you have to read the value entered by the user and then to call the respective function.arrow_forward
- Please complete the following function getGrade, which accepts only one parameter (int score), and must return its proper grade (i.e., char grade) to the caller. This function must determine the proper grade based on the score received as follows: THIS IS THE CODE I HAVE SO FAR. Need help with areas market "******". Thank you! grade = 'A' if score == 4 ; grade = 'B' if score == 3 ; grade = 'C' if score == 2 ; grade = 'D' if score == 1 ; grade = 'F' if score == 0 ; Otherwise, grade = '?' ; char getGrade( int score) // function returns a char to the caller { // parameter 1: int score (4 for example) // return: char grade (‘A’ for example) char grade = '?' ; // This is the only variable you can use ********* NEED HELP HERE ********* return grade ; } // end char getGrade( ) void main() // To test function getGrade( ) { cout << "score 4 -> grade = "…arrow_forwardWrite a function named “endingWithSlashSlash” that accepts the same parameters as command line arguments (argc and argv). It returns true if at least one of the arguments have a “//” at the end and false otherwise. This function also returns the number of arguments that have “//” at the end. For example, “//” will return true and 1 “one// two three// four” will return true and 2 “one” will return false and 0 “one two” will return false and 0 Please note that for question #5, you cannot refer or use string class, string methods such length() or size() or any string function such as strlen(), strcmp or strstr(). Please use only array notation, pointer to character, and/or pointer arithmetic and make use of the fact that this is a C-string.arrow_forwardPython question, please us a docstring and have comments throughout code Write a function getInteger() that takes two integers num1 and num2 as parameters. If num1 > num2, then the function prints an error message and returns 0. If num1 is equal to num2, the function returns the common value. For cases where num1 < num2, the function prompts the user to enter an integer greater than or equal to num1 and less than or equal to num2 and returns the first valid integer that the user enters. If the user enters something that is not an integer value, the programs should display an error message and re-prompt the user to enter a valid integer Below are some sample executions of the function. Use the while and if-elif statements and a try/except in the solution. Don’t forget to include the docstring and comments. Copy and paste or screen shot the code and the thirteen test cases shown below in your submission. . >>> getInteger(5,4) 5 and 4 are not valid parameters 0…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





