answersLogoWhite

0

#include<iostream>

#include<vector>

#include<string>

int main()

{

std::vector<std::string> names;

for (int loop=0; loop!=10;)

{

std::cout << ++loop << " enter a name: ";

std::string name;

std::cin >> name;

names.push_back (name);

}

}

User Avatar

Wiki User

10y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach

Add your answer:

Earn +20 pts
Q: Program that input ten names from user c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Answer them Thanks very much Write a program which has the user input the names first and last of 10 of your friends Output in a column the list of all the names in the exact?

This sounds like a homework question...


C plus plus get user input without prompting for it?

To prompt a user in C++ you use cout to output the prompt to the console (e.g., the screen). You then use cin to extract the input from the user. So to get user input without a prompt, simply do not output a prompt before accepting input. However, accepting user input without a prompt would be decidedly un-user-friendly, unless you can guarantee the input does not come from the keyboard. If you're not using the console and the program is actually running in an event-driven interface (such as Windows), then you need only trap the keyboard, mouse or other HID messages that are posted to your application via the application's message loop, and act accordingly.


Why would you need to convert a string to a numeric data type?

For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.For example, to interpret user input; to read data from a text file or from some other program that produces the data as a string.


A program that uses prompting messages to direct the user's input is running in?

Interactive mode


What is meant by input stream?

An input stream is a character sequence device or buffer from which input can be gathered. The standard input stream is usually a keyboard, data file or the output stream from another program. The user of the program can normally decide where standard input may be redirected from when launching the program, typically defaulting to the keyboard.