Question

Ask the user for an input of 3 things "ex: name of 3 friends, 3 of...

Ask the user for an input of 3 things "ex: name of 3 friends, 3 of your favorite movies,". and pront each thing on a seperate line. C++ please.
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <iostream>
#include <string>

using namespace std;

int main() {
    string name1, name2, name3;
    cout << "Enter name of your friend 1: ";
    getline(cin, name1);
    cout << "Enter name of your friend 2: ";
    getline(cin, name2);
    cout << "Enter name of your friend 3: ";
    getline(cin, name3);

    cout << "Your friends are" << endl;
    cout << name1 << endl;
    cout << name2 << endl;
    cout << name3 << endl;
    return 0;
}
Add a comment
Know the answer?
Add Answer to:
Ask the user for an input of 3 things "ex: name of 3 friends, 3 of...
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
  • Write a program that would ask the user to enter an input file name, and an...

    Write a program that would ask the user to enter an input file name, and an output file name. Then the program reads the content of the input file, and read the data in each line as a number (double). These numbers represent the temperatures degrees in Fahrenheit for each day. The program should convert the temperature degrees to Celsius and then writes the numbers to the output file, with the number of day added to the beginning of the...

  • (Java) HELP! Create a program that will ask the user to enter their first name and...

    (Java) HELP! Create a program that will ask the user to enter their first name and their favorite number. Ask the user if they would like the information repeated back to them. If they type "Y" display the answers back to them. If they type anything else, display the word "Goodbye". An example of what your output window should look like is below. The system-generated output is in red. The user-provided input is in green. (Your actual program will only...

  • modify this code to ask the user to enter their name five times name = input("what...

    modify this code to ask the user to enter their name five times name = input("what is your name?") for i in range(5): print(name)

  • Ask the user to input a scaler or a matrix then multiply the input by 2....

    Ask the user to input a scaler or a matrix then multiply the input by 2. Display the result with a proper explanation string in a single line using both the disp function and the fprintf function. please enter the value:[1 2 3] Ask the user to input a string (without the need to use single quotes). Use the fprintf function to store this string to a file.    can any one help please ? This is matlab language

  • Using C# Create a “Main” method that will take user input one line at a time...

    Using C# Create a “Main” method that will take user input one line at a time until they enter the phrase “done”. Store each line entered into an ArrayList, so that one element of the ArrayList is one line of user input. You do NOT need to write your own ArrayList class, please use the standard library implementation of an ArrayList. After the user finishes typing in input, ask the user for a location and file name. Save the contents...

  • # Ask the user for their name. # Ask the user for the bank/institution name. #...

    # Ask the user for their name. # Ask the user for the bank/institution name. # Ask the user for their initial investment amount. # Ask the user for three(3) different annual interest rates # Ask the user for two(2) different lengths of investment (as an integer in years) # Compute the value of their investment after the number of years & at each rate #print results I'm using python version 3.7

  • C++ Write a C++ program that user is able to choose the function of their wanting from this menu : Users will be asked...

    C++ Write a C++ program that user is able to choose the function of their wanting from this menu : Users will be asked to enter the movies they like along with the Genre and one Actor/Actress per movie. the entering process should look like this: Note that if the user enters yes, the program should start entering the next movie with its properties. Available movies must be entered as follow: The program should enter as many available movies as...

  • For Java Keyboard Input Lab3 Ask the user for their name. Then display their name to...

    For Java Keyboard Input Lab3 Ask the user for their name. Then display their name to prove that you can recall it. Ask them for their age. Then display that. Finally, ask them for how much they make and display that. You should use the most appropriate data type for each variable. Hello. What is your name? Dennis Hi, Dennis! How old are you? 37 So you're 37, eh? That's not old at all! How much do you make, Dennis?...

  • Ask uFor Ex. "Prompt user to enter a number" = user enters 10, your program should...

    Ask uFor Ex. "Prompt user to enter a number" = user enters 10, your program should output 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.ser to input a number, and then using a loop control statement (While, For, Do-While), output to the console the numbers beginning from 1, up to and including the number input by the user.

  • Question 4 (3 mark) : Write a Java program to ask the user to input an...

    Question 4 (3 mark) : Write a Java program to ask the user to input an integer number from the keyboard. The output should indicate whether it is positive, zero, or negative, an even number or an odd number. REQUIREMENTS • Your code should ask user to input an integer number, then decide its sign and parity based on this input. • Your code should use if-else statement. Your code must work exactly as the specification and the output should...

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