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
A __________ is the column of data in a database that is used as the basis for arranging data.
Llana [10]
The answer is sort key.  A Sort Key is the column of data in a database that is used as the basis for arranging data. Iy is also used for rearranging data in the column.  An Operational Database is used to collect, modify, and maintain data on a daily basis.
8 0
3 years ago
Read 2 more answers
Select the correct answer.
TiliK225 [7]

A group of reviewers with your highest ratings

3 0
2 years ago
What is a common use for append queries?
Karo-lina-s [1.5K]

Answer:

You use an append query when you need to add new records to an existing table by using data from other sources. If you need to change data in an existing set of records, such as updating the value of a field, you can use an update query.

6 0
3 years ago
Read 2 more answers
A​ ___________ identifies the content and purpose of the​ visual, along with whatever label and number​ you're using to refer to
Westkost [7]

Answer:Title

Explanation: Title is basically considered as the "heading" or the "topic" that is used for giving the hint about the content or visual. In context with the visual ,which is the piece of display where title determines about the reason of visual and also hints about the content .It also gives the reference number that a person assign to the visual.

7 0
3 years ago
To differentiate the absolute pathnames to files that are located on different drives, html requires you to include the drive le
Ber [7]
<span>To differentiate the absolute pathnames to files that are located on different drives, HTML requires you to include the drive letter followed by a </span>vertical bar.
4 0
3 years ago
Other questions:
  • Write a function called ReverseLetters that takes an input phrase consisting of a single word and reverses the sequence of lette
    15·1 answer
  • Electronic files created on a computer using programs such as word software are considered to be
    15·1 answer
  • #Write a function called "replace_all" that accepts three #arguments: # # - target_string, a string in which to search. # - find
    11·1 answer
  • Cual es la definición de grouded?​
    7·1 answer
  • You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?
    10·1 answer
  • You’ve just finished training an ensemble tree method for spam classification, and it is getting abnormally bad performance on y
    9·1 answer
  • What is the by stander effect
    9·1 answer
  • Why do many experts recommand longer time horizonal if you are doing high risk investment
    7·1 answer
  • The success criteria are used to judge whether a project is successful. False True <br> need it now
    13·2 answers
  • Why does this happen
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!