1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Advocard [28]
3 years ago
6

Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both sing

le words. Then the program outputs last name, comma, first name. End with newline. Example output if the input is: Maya Jones
Computers and Technology
1 answer:
Dmitriy789 [7]3 years ago
7 0

<em>Complete Question:</em>

<em>Write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.  </em>

<em>Example output if the input is: Maya Jones </em>

<em>Jones, Maya</em>

<em></em>

<em>In C++</em>

<em></em>

Answer:

The program written in C++ is as follows

<em>#include<iostream></em>

<em>using namespace std;</em>

<em>int main(){</em>

<em>string lname, fname;</em>

<em>cout<<"First name: ";</em>

<em>cin>>fname;</em>

<em>cout<<"Last name: ";</em>

<em>cin>>lname;</em>

<em>cout<<lname<<", "<<fname;</em>

<em>return 0;</em>

<em>}</em>

<em />

Explanation:

This line declares lname, fname as string to get the user's last name and first name, respectively

<em>string lname, fname;</em>

This line prompts the user for first name

<em>cout<<"First name: ";</em>

This line gets the user first name

<em>cin>>fname;</em>

This line prompts the user for last name

<em>cout<<"Last name: ";</em>

This line gets the user last name

<em>cin>>lname;</em>

This line prints the desired output

<em>cout<<lname<<", "<<fname;</em>

You might be interested in
Fill in the blanks to complete a summary of this part of the passage. For the power of Patents
PIT_PIT [208]
I’m confused . what do i do?
6 0
2 years ago
Read 2 more answers
After Maya gave her friend the password to a protected website, the friend was able to remember it only long enough to type it i
EleoNora [17]

Answer:

The correct answer is Short Term Memory.

Explanation:

The A and D options, Procedural and Implicit memory are two of the long-term memory types and the question states that Maya forgot the password after typing it in, so these options are incorrect. Option C, Flashbulb Memory is a type of memory which stores specific moments and events in a person's lifetime which are remembered like snapshots. So the correct answer is B, Short Term Memory. I hope this answer helps.

5 0
3 years ago
Which of these is not an example of a transition
Mrrafil [7]

Answer: post the picture

Explanation:

1. Take the picture

2. Post it on brainly

3. Get your answer

4 0
3 years ago
Authenticating information can be something a user knows, like a password; something a user has, like a smart card; or something
xenn [34]

Answer:. True

Explanation:

yes it is true in my opinion

8 0
2 years ago
To remove an embedded chart, you should _____ it and press the DELETE key. (Points : 2) move drag hide click
Readme [11.4K]
I think the answer would be "click" 
3 0
3 years ago
Other questions:
  • What identifies available computers through the internet?
    14·1 answer
  • Design a method for representing the state of a tic-tac-toe board in computer memory. can you fit your representation into three
    12·2 answers
  • The computer mouse is used to
    11·1 answer
  • Write a method called printRange that accepts two integers as arguments and prints the sequence of numbers between the two argum
    6·1 answer
  • Write a program that tells what coins to give out for any amount of change from 1
    6·1 answer
  • Write a Student class in Java which has a name, id_number, year (e.g. 2) and
    9·1 answer
  • For which type of long-distance call do you need to tell the operator the name of the person to whom you wish to speak?
    10·1 answer
  • The idea that innovations in transportation and communication technologies has changed the way we think about distance and time
    9·1 answer
  • Please help!<br><br> What is a non-iterative programming structure?
    11·1 answer
  • Plzzz help i need this today :(
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!