Question: Problem Declare a struct named Pet that represents a pet . The struct will have a single member variable of type string named name. In

Problem
Declare a struct named Pet that represents a pet . The struct will have a single member variable of type string named name. In the main function creates an instance of the struct named dog. Then assign the value "woofy" to the member variable of that instance. Do not use a pointer variable for dog.
Solution
The solution is partially provided. Complete the missing parts by filling in the blanks. Make sure your answers result in code that can be compiled. Avoid adding extra spaces and end with a semi-colon where necessary.
struct Pet
{
std::string name;
}
;
// mark end of struct definition
int main()
{
Pet dog;
dog.name = "woofy";
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!