answersLogoWhite

0


Best Answer

int main()

{

std::string first, last;

std::cout << "Enter your first name: ";

std::cin >> first;

std::cout << "Enter your last name: ";

std::cin >> last;

}

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

#include<iostream>

#include<string>

std::string input_value (const std::string& prompt)

{

while (true)

{

std::cout << prompt << ": ";

std::string input;

std::cin >> input;

if (input.size())

return input;

std::cout << "Bad input!\n";

}

}

int main()

{

std::pair<std::string, std::string> input;

input.first = input_value ("Enter forename");

input.second = input_value ("Enter surname");

std::cout << "You entered: " <<

input.first << " " <<

input.second << std::endl;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: A c comma c plus plus program that can accept first name surname and display it?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Design an algorithm that will accept a perons name from the screen entered as surname first name separated by a comma Your program is to display the name as first name followed by three blanks?

Design an algorithm that will accept a perons's name from the screen entered as surname, first name, separated by a comma. Your program is to display the name as frist name, followed by three blanks, followed by the surname. -defining diagram -pseudocode algorithm


Is there a comma between the surname and MD?

Yes


What is the simplest comma perfectly correct C plus plus program?

Ya mum


Why does open office ask you to accept changes made to a document?

It's the same with almost any program - not just Open Office. If you make a change to an existing document (even adding a simple comma) - the software will always ask you if you want to save the changes.


What is Delimited Text?

ASCII is the acronym for American Standard Codes for Information Interchange. It is used to determine which character to display when a keyboard key is pressed, or code entered. So it can refer to basic text. A delimited file is a file that includes text separated by commas or full stops or semi-colons or spaces, or whatever the user designates as a delimiter. If you have something like firstnames and surnames and dates of birth, they could be in a file with a comma after each one, indicating to a program that reads the file, like a spreadsheet or database, as to how to arranged the data. If it was being opened by a spreadsheet, it would start putting the data into cells. It would use the delimiter to decided at what point something goes into the next cell. So if you had a firstname, a comma and a surname, the firstname would be put into one cell and the surname into the next cell.


How do you program a pause into a phone number?

In a pocket PC telephone you enter a comma sign to act as a pause.


What is ASCII delimited text?

ASCII is the acronym for American Standard Codes for Information Interchange. It is used to determine which character to display when a keyboard key is pressed, or code entered. So it can refer to basic text. A delimited file is a file that includes text separated by commas or full stops or semi-colons or spaces, or whatever the user designates as a delimiter. If you have something like firstnames and surnames and dates of birth, they could be in a file with a comma after each one, indicating to a program that reads the file, like a spreadsheet or database, as to how to arranged the data. If it was being opened by a spreadsheet, it would start putting the data into cells. It would use the delimiter to decided at what point something goes into the next cell. So if you had a firstname, a comma and a surname, the firstname would be put into one cell and the surname into the next cell.


Such as a comma b and c or a comma b comma and c People say the last comma before and is not necessary?

last comma before the and is not necessary


In Microsoft Access if the value 1000.5 is entered in a field in access that has been defined as currency data type then the value will display how?

$1,000.50 (depending on how you configure comma and currency symbol)


How do you display the elements in a vector to the user?

Generally vectors are displayed in parenthesis with the vector components separated by a comma. If there are vectors within another vector then brackets are used for the internal vector.


Is there a Comma after except that?

No, there is not a comma after &quot;except that.&quot;


How would you write 5.3 trillion?

5 comma 300 comma 000 comma 000 comma 000 comma 000.