Question: #include #include using namespace std; //class inteface for template, Holder template class Holder { T data; public: void dataInput(); void dataOutput(); }; //Class implementation for

 #include #include using namespace std; //class inteface for template, Holder template
#include

#include

using namespace std;

//class inteface for template, Holder

template

class Holder

{

T data;

public:

void dataInput();

void dataOutput();

};

//Class implementation for class template, Holder

template

void Holder ::dataInput()

{

cout

cin>>data;

}

template

void Holder::dataOutput()

{

cout

cout

}

//Class Interfaces for Item and Food

class Item

{

private:

int num;

double price;

public:

friend ostream& operator

friend istream& operator>>(istream&, Item&);

};

class Food

{

private:

int fatGrams;

int calories;


public:

friend ostream& operator

friend istream& operator>>(istream&, Food&);

};

int main()

{

Holder num;

Holder anItem;

Holder goody;

cout

num.dataInput();

cout

anItem.dataInput();

cout

goody.dataInput();

cout

num.dataOutput();

cout

anItem.dataOutput();

goody.dataOutput();

return 0;

}

//Class Implementation for Item and Food

ostream& operator

{

out

return out;

}

istream& operator>>(istream& in, Item& a)

{

cout

in >> a.num;

cout

in >> a.price;

return in;

}

ostream& operator

{

out

return out;

}

istream& operator>>(istream& in, Food& a)

{

cout

in >> a.fatGrams;

cout

in >> a.calories;

return in;

}

Compare output A Output differs. See highlights below. Special character legend 439175 11935574 Input 119.49 62 1024 nt? Your output ends with Here's the data you requested: 4 Here's the data you requested:11935574 $119.49 Here's the data you requested:62grams fat1024calories Here's the data you requested: 439175 39175 Expected output Here's the data you requested: 11935574 $119.49 ends with Here's the data you requested:62 grams fat 1024 caloriest

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!