Ask Question
24 November, 20:00

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

+1
Answers (1)
  1. 24 November, 21:35
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers