Hello,
I've attached my code, I keep getting the Debug Assertion failed, Expression: string subscript out of range error

I can't find any errors in my logic and code for the functions, but obviously something is wrong, no matter where I put breaks, i still get the error when debugging. Any idea where I should look for the problem.

I am not going to deal with all the things that are wrong here

They include:

(a) a missing = in a test else if (opr1 ='(')
(b) stupid reassignment ifx[i] = ifx[i+1]; but loop on i.
(c) Failure to initialize variables and then do a test of two uninitialized variables
(d) Assuming a terminator char ( ; ) is in a string BUT then default string doesn't have it (i.e. you use ""). So test for the end of the string as well as the terminator.

However, from the code, with templates etc, you are clearly not a beginner BUT the trivial beginner errrors you are making are :
(It does seem that two different programmers wrote myStack and InfixToPostfix. -- these are the infixtopost problems:)

(i) Not using compiler warnings
(ii) writing using namespace std;
(iii) passing everything by value not reference
(iv) Not using the keyword: const
(v) not initializing variables
(vi) not writing copy/assignment methods for complex classes.
(vii) Breaking the program down into subunits, but not testing them individually.
(viii) using varaible names like ifx, which is a minor typo away from a mess.

Number (ii) is the cause of some of your strange error messages since you use a variable called list. This is only possible IF you got the scoping correct....

The whole point of a namespace is to avoid name pollution so don't take it away.

[Rant]
When I interview programmers I ask them to write a piece of code, and if they put "using namespace std" at the top of their program, they are 99% of the way to the "no hire" bucket because they can't have (a) read much (b) writen much code.
[/Rant]

Finally a bit of maths: A/B*C/D is the same as (A/B)*(C/D). Additionally
A/B/C is not the same as (A*C)/B but the same as (A/C)/B. Fix your precedence function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.