Ask Question

Assuming that a program has the following string object definition, which statement correctly assigns the string literal "Jane" to the string object?

string name;

name = "Jane";

string name = {Jane};

name = 'Jane';

name = Jane;

+4
Answers (1)
  1. 12 July, 01:31
    0
    name="Jane";

    Explanation:

    In C+ + assigning a value to a string object takes the following syntax:

    String variable declaration prior to the assignment using:

    string;

    String variable assignment:

    = "";

    As per the question, the variable-name is 'name' and variable-value is 'Jane'. So the required assignment has the format:

    string name;

    name="Jane";
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Assuming that a program has the following string object definition, which statement correctly assigns the string literal "Jane" to the ...” 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