Question: -----> extend the postfix evaluation program so that we can evaluate polish expression that contains a mixture of positive and negative numbers. -----> Add access

-----> extend the postfix evaluation program so that we can evaluate polish expression that contains a mixture of positive and negative numbers.

-----> Add access to such popular library functions: sin (s), cos (c), square root (r), and pow (p), using the library. To simplify the input, just use the first letter of these functions, e.g., -2 4 r p 3.6 2 / + 3 s - To compile all the files while making use of the math library, do the following: > cc getch.c gettop.c stack.c main.c -lm

-----> Make sure your program passes the little test as shown in the following page

WITHOUT any inputs or scanf :)

HERE is some sample code that we have used so far:

-----> extend the postfix evaluation program so that we can evaluate polish

code 2:

expression that contains a mixture of positive and negative numbers. -----> Add

And this is how to text it correctly:

access to such popular library functions: sin (s), cos (c), square root

thankssss

/ho #include #include #define NUMBER ,0, >more gettop.c //For isdigit() int getop (char s [])C int i, C; while ( (s [0]_cagetch () )== , s[1-,\01; //Skip all the leading spaces ,lic-,\t'); if ( ! isdigit (c)akc != , . , ) return c; //Must be an operator //Ready to read in a number i 0; if(isdigit (c))//Keep on reading in digits while (isdigit (s [++11-cagetch())) ; if (c--' .') //bypass the decimal and read in digits while(isdigit(s[++il c getch))); //Stop when c is not a digit s [1]=?0';//s[i] originally contains the value of c if (c!-EOF) ungetch(c) ;//Should not waste c, kept somewhere? printf("I am getting this much %s ", s); return NUMBER; /ho #include #include #define NUMBER ,0, >more gettop.c //For isdigit() int getop (char s [])C int i, C; while ( (s [0]_cagetch () )== , s[1-,\01; //Skip all the leading spaces ,lic-,\t'); if ( ! isdigit (c)akc != , . , ) return c; //Must be an operator //Ready to read in a number i 0; if(isdigit (c))//Keep on reading in digits while (isdigit (s [++11-cagetch())) ; if (c--' .') //bypass the decimal and read in digits while(isdigit(s[++il c getch))); //Stop when c is not a digit s [1]=?0';//s[i] originally contains the value of c if (c!-EOF) ungetch(c) ;//Should not waste c, kept somewhere? printf("I am getting this much %s ", s); return NUMBER

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!