Question: Resolve the errors C++ // Debug 11-1 // Function template finds half of an object #include #include using namespace std; template double half(int x) {

Resolve the errors C++

// Debug 11-1 // Function template finds half of an object #include #include using namespace std; template double half(int x) { double h = x / 2; return h; } class TuitionBill { friend ostream& operator<<(ostream, TuitionBill); private: string student; double amount; public: TuitionBill(string, double); double operator/(int); }; TuitionBill::TuitionBill(string student, double amt) { student = student; amount = amt; } double TuitionBill::operator/(int factor) { double half = amount / factor; return hafl; } ostream& operator<<(ostream& o, TuitionBill) { o << t.student << " Tuition: $" << t.amount << endl; return o; } int main() { int a = 47; double b = 39.25; TuitionBill tb("Smith", 4000.00); cout << "Half of " << a << " is " << half(a) << endl; cout << "Half of " << b << " is " << half(b) << endl; cout << "Half of " << tb << " is " << half(tb) << endl; 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!