Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

-----> 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:

image text in transcribed

code 2:

image text in transcribed

And this is how to text it correctly:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

Students also viewed these Databases questions