Respuesta :

Answer:

Following is the C++ code for the question given :-

#include <iostream>

#include<string>

using namespace std;

int main() {

   string s1,s2;//two strings to store the words.

   cin>>s1;//Input statement.

   cin>>s2;//Input statement.

   cout<<s1<<" "<<s2<<endl;//printing both words in one line separated by space.

return 0;

}

Input:-

make

choices

Output:-

make choices

Explanation:

I have taken two strings two store two words.After taking the input I have printed both the strings which contains the words entered by the user separated by space.

A program that uses two input statements to get two words as input:

char word1[50];

char word2[50];

cout<<”The program will get two words and print in a single line”

cout<<”Enter the first word”

cin>>word1;

cout<<”Enter the second word”;

cin>>word2;

cout<<”Words in single line:\n”;

cout<<word1 <<” “ << word2;

return;

}

In this program 2 character array variables are declared to get two inputs which is of string. The user is given a message to enter the first word. Then the user is prompted to enter the second word. Together the output is printed using “cout” operator.