Well, basically for a class I need to make a simple program that used templates, in which I receive data from the user that I dont really know the type of, until I receive it.
template <typename T>
int main()
{
Calculator<T> calc;
bool flag = true;
int punto = 0;
string entry, op;
T a, b, r;
entry = ' ';
while (flag) {
try {
cin << op;
entry += op;
for (int i = 0; i < entry.length(); i++) {
if (entry[i] == '+' || entry[i] == '-' || entry[i] == '*' || entry[i] == '/') {
for (int j = 0; j < i; j++) {
if (entry[j].isdigit) {
a += entry[j];
}
else if (entry[j] == '.') {
a += entry[j];
punto++;
if (punto > 1) {
throw '.';
}
}
else{
throw "l";
}
}
if (punto = 1) {
a = stof(a);
}
else {
a = stoi(a);
}
I know the problem is the template part at the start, but sice I need to change the type a couple types I dont really know what to do. Obviusly because of the template it doesnt detect my main() fuction as main and is giving me the "Header Errors LNK2019"