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
Write a code that takes numbers from the user as a list. (User can enter as many numbers as he wants). Then, find mean and stand
8090 [49]

nums = list(map(int, input().split()))

mean = sum(nums)/len(nums)

print("The mean is",mean)

values = 0

for x in nums:

   values += abs(x - mean)**2

print("The standard deviation is",(values / (len(nums)-1))**0.5)

I wrote my code in python 3.8. I hope this helps.

7 0
2 years ago
Jim wants to buy a car, but he’ll probably only need it for a couple of years. He has a short commute to work, so he won’t be pu
aalyn [17]
The best is bus or walking
4 0
3 years ago
All living organisms make up the (4 points)
Airida [17]
Biosphere..
hope it helepd
3 0
3 years ago
Judy forgot where she saved a certain file on her computer. Therefor, she searches for all files with a jpg file extension. Whic
Keith_Richards [23]
What are these files anyways
6 0
2 years ago
Read 2 more answers
Which Internet Explorer security zone includes all Internet Web sites that are not specifically assigned to another zone?
Anna007 [38]

Answer:

Internet is the correct answer for the above question.

Explanation:

  • The Internet Explorer define some security zone (which includes the Restricted sites, internet, Trusted sites, and Local intranet) which is used to block the unwanted sites which can be opened by some other websites.
  • When any user use any website, sometimes that websites open different websites. This security zone gives the features to secure the user from this event.
  • There are four-zone which are described in the first line, in which the internet zone is used to take all the websites which are not defined for the other security zone. It means that when any user does not decide the security zone for any websites then by default it comes in the internet zone.
  • This is also asked by the question, Hence "internet" is the correct answer.
4 0
2 years ago
Other questions:
  • Shelly praised Susan via email for how well she executed an employee training program last week. Shelly is engaging in the _____
    6·1 answer
  • Clip art, by default, is formatted as a(n) ____, which cannot be moved to a precise location on a page.
    14·1 answer
  • What is the purpose of inserting SmartArt in a Microsoft Office program? (1 point)
    11·2 answers
  • Write a brief one parapragh summary describing the financial reality of the American family.
    10·1 answer
  • Create a style rule for the page body that sets the width to 95% of the browser window ranging from 640 pixels up to 960 pixels.
    11·1 answer
  • Not every organization integrates with the Internet, but all use some or most of the technology that gave rise to it.
    15·1 answer
  • PLEASE HURRY!!!!
    8·2 answers
  • What is the best food to eat before workout? why?​
    10·2 answers
  • Microsoft recommends when that you create passwords with upper and lowercase letters, numbers, symbols, and use at least _______
    5·1 answer
  • One of the most notable impacts of IT on business is improved
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!