Question: Template Specialization You are given a Div class template, which has a constructor that takes two parameters and outputs their division. You need to specialize
Template Specialization
You are given a Div class template, which has a constructor that takes two parameters and outputs their division. You need to specialize the class for strings, which should output the division of the lengths of the parameter strings, as the division operator is not defined for strings. Create the template specialization so that the code in main executes correctly.
You can get the length of a string using the size() function.
#include
using namespace std;
template
class Div {
public:
Div (T x, T y) {
cout < } }; //your code goes here int main () { string a, b; cin >> a >> b; int x, y; cin >> x >> y; Div Div }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
