Ask Question
20 December, 06:36

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.";

+4
Answers (1)
  1. 20 December, 10:04
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers