Ask Question
24 April, 12:10

Write a program that uses two input statements to get two words as input. Then, print the words on one line separated by a space.

+1
Answers (2)
  1. 24 April, 12:21
    0
    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<
    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.
  2. 24 April, 12:25
    0
    Following is the C+ + code for the question given : -

    #include

    #include

    using namespace std;

    int main () {

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

    cin>>s1; //Input statement.

    cin>>s2; //Input statement.

    cout<
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a program that uses two input statements to get two words as input. Then, print the words on one line separated by a space. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers