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
Darcy was working on a presentation on playing chess. Because she chose the Checkerboard animation for her slide title, she had
otez555 [7]
The answer is true
Helene
7 0
3 years ago
Read 2 more answers
A technology company only hires applicants who are under the age of 30. This company could face possibly _________ consequences
Black_prince [1.1K]
They could face legal consequences for discrimination. Hope this helps!
3 0
4 years ago
Read 2 more answers
​_____ was the first commercially successful computer. ​z3 ​eniac ​univac ​colossus
Lera25 [3.4K]
 <span>​ENIAC was the first commercially successful computer, released in 1946.
</span>The name ENIAC Electronic Numerical Integrator And Computer<span>).</span><span>
 It was </span>used to calculate artillery firing tables for the United States Army's Research Laboratory.
It was invented by J. Presper Eckert and John Mauchly at the University of Pennsylvania.
7 0
3 years ago
Please help me please it's urgent​
il63 [147K]

Answer:

age = input()

if age < 13:

   print("Not allowed")

else:

   print("Allowed")

7 0
3 years ago
Which of the following is considered to be intellectual property?
ad-work [718]

The answer is actually A. I took the test and selected the wrong answer, but A was the one the test said was right. Plz mark brainliest!!! Hope this helped! ;^)

4 0
3 years ago
Other questions:
  • When desktop publishing software can interact with another software program, the two are said to
    6·1 answer
  • Why is the protocol down, even though you issued the no shutdown command for interface vlan 99?
    5·2 answers
  • To insert notes into a worksheet, insert ________ in cells.
    15·1 answer
  • Answer these two if u can❤️
    5·2 answers
  • Java
    15·1 answer
  • Who created apple and in what year was it created
    9·2 answers
  • What does the CFO of a company do
    14·1 answer
  • Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters.
    7·1 answer
  • What is said to be the first mechanical calculator​
    7·2 answers
  • What is the expression for the resultant value of three capacitance where C1 connected in parallel​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!