15 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for Joemeister

I am trying to transform a infix mathematical expression into a postfix expression using the shunting yard algortihm but can only get so far by writing the pseudo code because I know exactly what to do through logical thinking but can't write the code that will help me do it. …

Member Avatar for iamthwee
0
598
Member Avatar for Wayniepooo

Hi basically i need help , i am not good with c++ but i am trying my very best. i am currently stuck with trying to do an infix to postfix conversion that reads from a textfile. The text file contains the infix notations and the code is suppose to …

Member Avatar for Wayniepooo
0
1K
Member Avatar for RounaqJJW

#include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #define size 400 using namespace std; char infix[size],postfix[size],Stack[size]; int top; int precedence(char ch) { switch(ch) { case '^':return 5; case '/':return 4; case '*':return 4; case '+':return 3; case '-':return 3; default:return 0; } } char Pop() { char ret; if(top!=-1) { …

Member Avatar for Schol-R-LEA
0
976
Member Avatar for greyfox32

I am working on a project for class. I have to write a program that reads in an infix expression and converts and it to postfix and evaluates it. Currently I have it to where I can convert an infix expression with no parentheses to postfix, but am having some …

0
167
Member Avatar for prakhs

Hi, Please help me debug this code. I made a Stack template with two parameters: type and size. I am using it two times: first in conversion from infix expression to postfix (here, <char,50> stack is used), then in evaluation of postfix expression (here, <long double, 50> stack is used). …

Member Avatar for prakhs
0
940
Member Avatar for mjbor1

i have problem in convert infix to postfix some expression evaluate it correctly and other no ex: c\*(a+b) evaluate it correctly but A\*(B\*C+D)+E doesn't evaluate correctly and there is another problem in finding result my code // convert.h const char SIZE=100; class stack { public: stack(); bool isempty()const; bool isfull()const; …

Member Avatar for mjbor1
0
370
Member Avatar for DelilahDemented

The program runs and gives the correct data until it gets to the 4th line of the input. At the 4th line, the calculation is incorrect and when it gets to line 6 of the input, it just stops completely. I can't quite figure it out. Any help is greatly …

0
125
Member Avatar for ashish karna

hi i want to convert the prefix form to postfix,prefix and infix form but when i input +5*62 it retuns only 2 what is wrong with my code can anybody help to solve this #include<stdio.h> #include<conio.h> #include<stdlib.h> #define Operator 1 #define notOperator 0 #define empty -1 struct node{ char item; …

Member Avatar for deceptikon
0
209
Member Avatar for Gsterminator

Hello community, I have an issued converting a arithmetic string called the infix, into a prefix output. In one of my methods i have an infinite loop. An example would be (a + b) * (c - d)===> * + a b - c d Here is my code: [CODE] …

Member Avatar for Gsterminator
0
1K
Member Avatar for cameronchuck

Hi! I am trying to write calculator in c++ that takes an infix expression, converts it to postfix, and calculates. I have the code that will do this written, but when I try to turn it into a class it gives my a Segmentation Fault. Here is my code... [CODE=c++]//calc.h …

Member Avatar for histrungalot
0
3K
Member Avatar for ThatGuywithCode

So basically I need to find a way to evaluate an infix that's been converted into a postfix. The code below takes an entered infix and converts it into a postfix but I don't know how to take that postfix and evaluate it. Every single tutorial I've seen evaluates a …

Member Avatar for WaltP
0
227
Member Avatar for cgen

I need some idea how to correct this program. Though I think I understand the concept, my implementation is wrong. My program only prints the orignal string and does nothing with it. [CODE] public class ArrayStack<E> implements Stack<E> { protected int capacity; protected static final int CAPACITY = 1000; protected …

Member Avatar for JamesCherrill
0
1K
Member Avatar for ronnieaka

here's the infix expression: [B]EXAMPLE 1[/B] a/(b+c)*d according to me, if [B]*[/B] is given higher precedence then [B]/[/B] , then this should be the postfix expression: [B]1) abc+d*/ [/B] if / has higher priority then * , then: [B]2) abc+/d*[/B] [B]question 1: [/B]which is correct?? 1 or 2 ? according …

Member Avatar for TrustyTony
0
238
Member Avatar for rockerjhr

main.c [CODE]#include "stack.h" #include "stack_interface.h" #include "lex.h" #include <stdio.h> #include <stdlib.h> #define PUSH(s,c) if(push_char(s,c) == ERROR){ printf("Fatal error in pushing symbol on stack.\n") ; exit(1) ; } #define POP(s,c) if(pop_char(s,c) == ERROR){ printf("Fatal error in poping symbol off stack.\n") ; exit(1) ; } #define TOP(s,c) if(top_char(s,c) == ERROR){ printf("Fatal error …

Member Avatar for Narue
0
250
Member Avatar for lilbenji25

Hey, i know you are all probably very bored with the infix to postfix program and its many incarnations but i seem to be having a problem getting the linked list we have to use as a stack to work. More specifically; pushing to the stack, reading from the top …

Member Avatar for nezachem
0
179

The End.