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.

  • 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

  • C++ please! (1) Prompt the user to enter the name of the input file. The file...

    C++ please! (1) Prompt the user to enter the name of the input file. The file will contain a text on a single line. Store the text in a string. Output the string. Ex: Enter file name: input1.txt File content: We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here; our hopes and our journeys continue! (2) Implement a PrintMenu() function,...

  • C program help 4. Write a function called scan_hex. Here is its prototype: void scan_hex(int *xptr);...

    C program help 4. Write a function called scan_hex. Here is its prototype: void scan_hex(int *xptr); Here is an example of its use, in conjunction with print_decimal. Assume that the user will type a non-negative hex number as input. Also, assume that the “digits” a-f are in lower case. Let’s say the user types 1b int x; scan_hex(&x); print_decimal(x); MODIFY THIS CODE // function inputs a non-negative integer and stores it into *xptr. // The format of the input is...

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