Question

C++ Write a void function called getAge that has no formal parameter. The function should prompt the user for their...

C++ Writevoid function called getAge that has no formal parameter. The function should prompt the user for their age.

An example of the call to the function could be as follows

getAge();

0 0
Add a comment Improve this question Transcribed image text
Answer #1
nswer:
void getAge(){
    int age;
    cout<<"Enter your age: ";
    cin>>age;
}

Note Please comment below if you have any doubts

Add a comment
Know the answer?
Add Answer to:
C++ Write a void function called getAge that has no formal parameter. The function should prompt the user for their...
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
  • In C++: A. Write 3 functions that are called in the program. 1. Function readInput prompt...

    In C++: A. Write 3 functions that are called in the program. 1. Function readInput prompt user to enter an integer to store to the parameter. 2. Function isPerfectSquare take an integer parameter and checks whether it's a perfect square, that it's square root is an integer. 3. Function min3 return the mainimum value of the parameter values, it shouldn’t use any if statement to compare the parameters but call min2 to do the comparison. Extra Credit: Function printPrimeFactorization print...

  • Instructions Write a program called stocks.cpp. The program should prompt the user for the number of...

    Instructions Write a program called stocks.cpp. The program should prompt the user for the number of shares purchased, purchase price per share, the commission for the purchase, sale commission paid, and the price the shares were sold at. The program should validate each of these values to ensure they are acceptable (none of these values can be less than zero) and should then pass them to a function called calculateProfit. The function should use the following formula to determine the...

  • Write a void function called FlipString. It should have 1 string parameter passed by reference. It...

    Write a void function called FlipString. It should have 1 string parameter passed by reference. It should replace each capital letter with its lowercase letter, and each lowercase letter with its capital letter. Use the functions toUpper() and toLower() to help you.

  • Write a C++ Program. you were required to first create a function called average. The return...

    Write a C++ Program. you were required to first create a function called average. The return type is double and it takes in two parameters, one of type string the other of type double. In the average function write a for loop that PROMPT THE USER to enter in a grade 5 times, keep a sum of all the different grades then return the average of the grades. (sum / 5) Next write a function of type double called lowest...

  • C++ TrainStation Program Create a function called searchForSchedules that will: - prompt a user to enter...

    C++ TrainStation Program Create a function called searchForSchedules that will: - prompt a user to enter a scheduleId - search for arrival and departure times of trains based on a trains ID number Create a function called editSchedules that will: - allow the user to edit the fields for a given schedule that is in the linked list. - the program must prompt the user to enter the scheduleId as the key to find the schedule to edit. Print a...

  • Visual Basic: Write the code for a function named GetMajor. The function should prompt the user...

    Visual Basic: Write the code for a function named GetMajor. The function should prompt the user to enter a major field of study and then return the user’s response. Then write a statement to invoke the GetMajor function, returning the result to the strCurrentMajor variable.

  • Write a program that will do the following. The main function should ask the user how...

    Write a program that will do the following. The main function should ask the user how many numbers it will read in. It will then create an array of that size. Next, it will call a function that will read in the numbers and fill the array (fillArray). Pass the array that was made in themain function as a parameter to this function. Use a loop that will read numbers from the keyboard and store them in the array. This...

  • Write a C function named: div() with one local variable: m to prompt the user to...

    Write a C function named: div() with one local variable: m to prompt the user to enter one integer for the local variable m. When you call the function, it should display one of the following lines: If m is divisible by 9 the function displays the message m is divisible by 9 If m is divisible by 3 and not divisible 9 (e.g. 24) the function displays the message m is divisible by 3 If m is neither divisible...

  • Write a function called productEven that takes as its parameter an input file. The function should...

    Write a function called productEven that takes as its parameter an input file. The function should read two integers and calculate the total product of only even numbers between them. Return the answer to the calling function. c++ program

  • please write program in C++ Write a function called productEven, that takes as its parameter an...

    please write program in C++ Write a function called productEven, that takes as its parameter an input file. The function should read two integers and calculate the total product of only even numbers between them. Return the answer to the calling function. please write the program in C++

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