Ask Question

Assume user_name equals "Tom" and user_age equals 22. What is printed on the console when the following statement is executed? cout << user_age << " / nis " + user_name << "'s age.";

+3
Answers (1)
  1. 15 April, 19:44
    0
    The ouput of the given code is:

    22

    is "Tom's age.

    Explanation:

    Here in this code the variable user_name and user_age are initialized to "Tom" and 22 respectively as statement is given in the question i. e cout << user_age << " / nis " + user_name << "'s age.";. This line will print the user_age i. e 22 after that the control moves to the next line and print is "Tom's age.

    Following are the code in c++

    #include / / header file

    #include

    using namespace std;

    int main () / / main function

    {

    string user_name="Tom";

    int user_age = 22;

    cout << user_age << " / nis " + user_name << "'s age.";

    return 0;

    }

    Output:

    22

    is "Tom's age.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assume user_name equals "Tom" and user_age equals 22. What is printed on the console when the following statement is executed? cout ...” 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