To all the Masters,

Sir can you help me in this problem, the program tells the infix to convert into postfix.
ex.
a+b-b*c+g/s
=ab+bc*-gs/+

My problem is, once you compile the program there is no error message, but if you run it, the output did not show. I know this is a logical error, I'm trying to use a linked list and I'm newbee from this struct type. I can implement the problem using array but I'm exercising myself to use the structure in c++. It is hard for me to understand the function of this struct data type, can you help me in this problem.

The program is not finished, I'm just testing the concept of struct data type.

the file is attached in cpp format.

thank you and more power.

Gaspan, Mark Cristian
BSCS, Student.

why would you create such a stupid poll in this thread??????

Member Avatar for iamthwee

I voted infix to postfix.

Well it's already broken before it's even got 10 lines into the program.

> cin>>dataned;
Each dataned is an UNINITIALISED pointer. You're busily scribbling data all over other peoples memory.

> while(dataned==" ")
This is unlikely to be ever true (pure luck basically), so the loop only happens once (if it even gets there).
Further, since you increment i, you're not even attempting to compare with the input.

> ptr1=ptr1->next;
You only allocate 1 node, so the rest of whatever you're pointing at in your linked list is garbage.

Since this is C++ (I guess), I would think you're supposed to model the idea of 'stack' as a class, with the well known 'push' and 'pop' methods.
That at least would clear away a lot of the complexity from your overly long main() 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.