Question

Write the function definition for a function which asks the user for their name and then...

Write the function definition for a function which asks the user for their name and then prints a personalized greeting. DO NOT WRITE AN ENTIRE PROGRAM. DO NOT WRITE THE STATEMENT THAT CALLS THE FUNCTION JUST WRITE THE FUNCTION DEFINITION

Homework Answers

Answer #1

//Function for asking user name

void userDetails(){

//Asking user first name ,surname and lastname using c++

string firstName;

string surName;

string lastName;

cout<<"Enter your first name"<<endl;

cin>>firstName;

cout<<"Enter your surname"<<endl;

cin>>surName;

cout<<"Enter your last name"<<endl;

cin>>lastName;

//Displaying the greetings for particular user

cout<<"Hello Mr. "<< firstName <<" "<< surName <<" "<< lastName <<endl;

}

Know the answer?
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
Similar Questions
Write a function definition for a function which accepts three values from the main program and...
Write a function definition for a function which accepts three values from the main program and prints the largest of the three values. DO NOT WRITE AN ENTIRE PROGRAM. DO NOT WRITE THE STATEMENT THAT CALLS THE FUNCTION! JUST WRITE THE LINES OF CODE FOUND IN THE FUNCTION DEFINITION
Write the function definition for a function which accepts 2 values from the main program and...
Write the function definition for a function which accepts 2 values from the main program and returns the average of the two numbers. DO NOT WRITE AN ENTIRE PROGRAM. DO NOT WRITE THE STATEMENT THAT CALLS THE FUNCTION! JUST WRITE THE FUNCTION DEFINITION python program
Write a program that asks the user for the name of a file. The program should...
Write a program that asks the user for the name of a file. The program should display only the first five lines of the file’s contents. If the file contains less than five lines, it should display the file’s entire contents. by python using while loop
- Write a Python program which asks the user to enter a number, if the number...
- Write a Python program which asks the user to enter a number, if the number is divisible by 6 or 7, the program prints “The number X is divisible by 6 or 7” and if the number is neither divisible by 6 nor by 7, then it prints “The number X is not divisible by 6 and 7”.
**C code only In this part, you will write a simple user-defined function that prints a...
**C code only In this part, you will write a simple user-defined function that prints a message. This function does not require any parameters or return value. The purpose is simply to get you started writing functions.Open repl project Lab: User-Defined Functions 1. Write a program that calls a function. This function should do the following: 1.Ask the user their name 2. Print a "hello" message that includes the user's name Example output: Please enter your name: ​Mat Hello, Mat!...
A. Write a Java program that asks the user to enter “bus” or “subway” or “walk”....
A. Write a Java program that asks the user to enter “bus” or “subway” or “walk”. If the user enters “bus” display “$1.00”. If they enter “subway” display “$1.50 and if they enter “walk” display “Free”. B. Write a java program that creates the following two arrays: String[] candidates = {“S Jones”,”Justin Fairfax”,”Clark Duncan”}; int[] votes = {7345,4324,3211}; Write the code that will search the votes array for the candidate with the largest number of votes and prints the name...
IN PYTHON : Write a program that asks the user for a number. Write the number...
IN PYTHON : Write a program that asks the user for a number. Write the number to a file called total.txt. Then ask the user for a second number. Write the new number on line 2 with the total for both numbers next to it separated by a comma. Then ask the user for a third number and do the same. Keep asking for numbers until the person puts in a zero to terminate the program. Close the file. Be...
1)Write a program that asks a user for a number. If (and only if) the number...
1)Write a program that asks a user for a number. If (and only if) the number is greater than zero print “The number is valid” 2)Write a program that asks a user for a grade. If (and only if) the grade is greater than zero and less than 101, print “The grade is valid” 3)Write a program that asks a user how many widgets they want to buy and prints out what the user should pay. Widgets costs 10 dollars....
python code Write the function definition for a function which accepts one value from the main...
python code Write the function definition for a function which accepts one value from the main program and prints three times the number that is sent to it. For example, if the program sent 8, the function would print 24.
in c++ Write a C++ program that asks the user to enter an integer number and...
in c++ Write a C++ program that asks the user to enter an integer number and prints it back "vertically" to the screen. Use recursion in your solution. As an example of how the program will work: Please enter an integer: 12345 The integer you entered will print vertically as: 1 2 3 4 5
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT