answer.
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]
2 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]2 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
The Spinning Jenny reduced the number of workers necessary to _______. a.remove cotton seeds from fibers b.pump water from the m
bazaltina [42]

The answer is D: Turn yarn into cloth.

During the industrial revolution, a number of new inventions in the textile industry greatly impacted this industry. However, it was the invention of the Spinning Jenny that is credited a lot. It helped move the textile industry from homes to factories and made wool spinning easier and faster. This invention, however, impacted the labor workforce. It reduced the amount of work needed to produce yarn. One worker was able to work 8 or more spools at once and rose to 120 due to technological advancements.

5 0
2 years ago
To erase an entire entry in a cell and then reenter the data from the beginning, press the ____ key. alt esc ctrl tab
Daniel [21]
To erase an entry in a cell and then reenter the data from the beginning press the esc key. Hope that helps!
8 0
2 years ago
Complete the function ConvertToDecadesAndYears to convert totalYears to decades and years. Return decades and years using the Ti
Sergeeva-Olga [200]

Answer:

It is a C++ program. The complete function   ConvertToDecadesAndYears which takes totalYears as parameter and convert totalYears to decades and years is provided in the attached document.

Explanation:

The explanation is provided in the attached document.

The screenshot of the complete code along with its output is attached.

6 0
2 years ago
Select the correct answer.
marta [7]

Answer:

A market development

Explanation:

It can be marketing but marketing is attracting satisfying customers, whereas the marketing development is the growth strategy which first finds out, and then develops a new market segment. Nora conducts the surveys of different age group people, and from various social backgrounds, and finds what is the potential target audience. Hence, she is certainly finding the potential target audience for her company's product. And hence she is doing market development, as she is finding a new market segment, and developing it. And hence market development is the correct option.

7 0
2 years ago
Write a program that reads an integer and displays, using asterisks, a filled diamond of the given side length. For example, if
zaharov [31]

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        int n = input.nextInt();
  6.        int l = 1;
  7.        for(int i=1; i <= n; i++){
  8.            for(int j=1; j<= l; j++){
  9.                System.out.print("*");
  10.            }
  11.            System.out.println();
  12.            l = l + 2;
  13.        }
  14.        l = l - 4;
  15.        for(int i=1; i < n; i++){
  16.            for(int j=1; j <= l; j++){
  17.                System.out.print("*");
  18.            }
  19.            System.out.println();
  20.            l = l-2;
  21.        }
  22.    }
  23. }

Explanation:

The solution code is written in Java.

Firstly use a Scanner object to accept an input integer (Line 5-6).

Create the first set of inner loops to print the upper part of the diamond shape (Line 8-14). The variable l is to set the limit number of asterisk to be printed in each row.

Next, create another inner loops to print the lower part of the diamond shape (Line 17-23). The same variable l is used to set the limit number of asterisk to be printed in each row.

3 0
2 years ago
Read 2 more answers
Other questions:
  • Your computer has gradually slowed down. What's the most likely reason?
    8·1 answer
  • Jim has excellent oral and written communication skills. He enjoys public speaking and wants a job in which he will interact wit
    14·2 answers
  • Shirley was unsure about what career to go into. Her high school counselor suggested a personal assessment to point out Shirley’
    12·2 answers
  • Suppose you have a certain amount of money in a savings account that earns compound monthly interest, and you want to calculate
    10·2 answers
  • Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
    14·2 answers
  • Assume the existence of a Window class with a function getWidth that returns the width of the window. Define a derived class Win
    15·1 answer
  • Justin signed a rental agreement for his new condo. How long is his lease? a p e x
    15·1 answer
  • Given the macro definition and global declarations shown in the image below, provide answers to the following questions:
    5·1 answer
  • A time-saving strategy that helps define unfamiliar words involves using
    13·2 answers
  • Accenture has partnered with a global construction company that specializes in building skyscrapers. The company wants better ma
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!