Question

Need help problem 9-13

C++ Homework please help

WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototype10.) (1 pt.) Write a complete function definition for the getChoice function. sufThis function should match the prototype inshowResult() function - DO NOT WRITE THE DEFINITION FOR THIS FUNCTION. - ONLY WRITE THE FUNCTION PROTOTYPE ABOVE MAIL(#4) UsecalcSquare() function - DO NOT WRITE THE DEFINITION FOR THIS FUNCTION. ONLY WRITE THE FUNCTION PROTOTYPE ABOVE MAIN. (#7) - U

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//(9)
void showMenu(){
   cout<<"A. Multiply a number by 2.\n";
   cout<<"B. Divide a number by 2.\n";
}
//(10)
char getChoice(){
   char choice;
   cout<<"Enter your choice: ";
   cin>>choice;
   return choice;
}
//(11)
double calcResult(char choice , double num1){
   if(choice == 'A') return num1*2;
   if(choice == 'B') return num1/2;
}
//(12)
void getInfo(string firstName , char initial , string lastName){
   cout<<"First Name: ";
   cin.get();
   getline(cin,firstName);
   cout<<"Initial: ";
   cin>>initial;
   cout<<"Last Name: ";
   cin.get();
   getline(cin,lastName);
}

//(13)
bool isPositive(double num){
   if(num>0) return true;
   return false;
}

Add a comment
Know the answer?
Add Answer to:
Need help problem 9-13 C++ Homework please help WRITE FUNCTION PROTOTYPES for the following functions. The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Need help with this C++ homework I need help problem 1-9 that possible if my wish?...

    Need help with this C++ homework I need help problem 1-9 that possible if my wish? Thank you friend Tiet WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in maino. mm 1.) showMenu m2.) getChoice 3.) calcResult m.) showResult 5.) getInfo mm.) showName 7.) calcSquare 8.) ispositive int main { USE THESE VARIABLES, when needed, to write function prototypes (#1 - #8)...

  • need help on this! Just write the function prototype for the following finctions while also using...

    need help on this! Just write the function prototype for the following finctions while also using the variables below to help write the prototype! thanks!! WRITE FUNCTION PROTOTYPES for the following functions. The functions are described below on page 2. (Just write the prototypes) When necessary, use the variables declared below in main(). I 1.) showMenu 2.) getChoice 3.) calcResult 4.) showResult 5.) getlato 6.) showName 7.) calcSquare 8.) is Positive int main() USE THESE VARIABLES, when needed, to function...

  • answer in c++ Using the table below, complete the C++ code to write the function prototype...

    answer in c++ Using the table below, complete the C++ code to write the function prototype statement, and the void function header. The void function should receive three double variables: the first two by value and the last one by reference. Name the formal parameters num1, num2 and answer. The function should divide the num1 variable by the num2 variable and then store the result in the answer variable. Name the function calcQuotient. Also write an appropriate function prototype for...

  • In C please Write a function so that the main() code below can be replaced by...

    In C please Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original maino: int main(void) { double milesPerHour, double minutes Traveled; double hours Traveled; double miles Traveled; scanf("%f", &milesPerHour); scanf("%lf", &minutes Traveled); hours Traveled = minutes Traveled / 60.0; miles Traveled = hours Traveled * milesPerHour; printf("Miles: %1f\n", miles Traveled); return 0; 1 #include <stdio.h> 3/* Your solution goes here */ 1 test passed 4 All tests passed...

  • You are to write a program IN C++ that asks the user to enter an item's...

    You are to write a program IN C++ that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: if the an item's wholesale cost is 5.00 and its markup percentage is 100%, then the item's retail price is 10.00 If an item's wholesale cost is 5.00 and its markup percentage is 50%, then the item's retail price is 7.50 Program design specs. You should have 5...

  • In C code Directions: Write fully executable code when answering the following: 1. Write a function...

    In C code Directions: Write fully executable code when answering the following: 1. Write a function prototype for a function called GetInput that takes no arguments. The function will ask, get, and then return a double value input from the user. 2. Write the function definition for GetInput 3. Write the function call to GetInput using the variable points that has already been declared

  • can someone help me with this C++ problem write your game() function and 3+ functions that...

    can someone help me with this C++ problem write your game() function and 3+ functions that simulate the game of Jeopardy Dice according to the following game mechanics and specifications. Game Mechanics There are two players: the user and the computer, who alternate turns until one of them reaches 80 points or higher. The user is always the first player and starts the game. If any player reaches 80 points or more at the end of their turn, the game...

  • Objectives Work with functions Assignment Write each of the following functions using Python. The function header MUST b...

    Objectives Work with functions Assignment Write each of the following functions using Python. The function header MUST be written as specified. In your main code test all of the specified functions. Each function must have a comment block explaining what it does, what the parameters are and what the return value is. Please remember the following two guidelines: unless the purpose of the function is to generate output DO NOT write to the screen within the function unless the purpose...

  • Functions can return a string, not just an int or a float. Write a function called...

    Functions can return a string, not just an int or a float. Write a function called everOrOdd which takes an integer parameter and returns either "Even" or "Odd" based on the value passed. In main, prompt the user for a number, called num, then pass num to evenOrOdd and display the returned value on the screen. Keep doing this until the user enters a zero. Use the following run as an example: Enter a number: 11 Odd Enter a number:...

  • In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops...

    In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops for the input validations required: number of employees(cannot be less than 1) and number of days any employee missed(cannot be a negative number, 0 is valid.) Each function needs a separate flowchart. The function charts are not connected to main with flowlines. main will have the usual start and end symbols. The other three functions should indicate the parameters, if any, in start; and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT