so i made a very simple stack that works just fine and decided to turn it to template, it also worked fine, but when i turned it to integer something happened with the input
string m;
getline(cin, m);
linkedliststack<int> str;
for (int i = 0; i < m.length(); i++)
{
str.push(m[i]);
}
It appeared that by using this input method the m[i] becomes char turned to int, in other words turned to ASCII code, so if i enter 1 it give 48, 2 give 49 etc. The simple solution is of course this.
str.push(m[i]-48)
But is there a way to make it automated, e.i. with if condition or anything? If yes then what is the required syntax?
Thanks.