funs: This function calculates postfix expression

Description Usage Arguments Value Author(s) Examples

Description

This program computes the value by accepting the string input which is space-delimited arithmetic expression in postfix notation.

This program computes the value by accepting the string input which is space-delimited arithmetic expression in prefix notation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
check_valid_operators(operator)

check_operator(char)

check_digit(number)

perform_operation(z, x, y)

push(input_vector, values)

pop(input_vector)

calculate_postfix(input_string)

check_digit(number)

evaluate_prefix(expression)

Arguments

operator

A string with mathematical operators

char

This function checkd if the character value is

number

checks if input is a number

z

operand 2

x

operand 1

y

operator

input_vector

input vector

values

numeric values

input_string

A string with space-delimited integer arithmetic expression in postfix notation.

expression

A string with space-delimited integer arithmetic expression in prefix notation

Value

A integer value

A integer value

Author(s)

Som Bohora

Som Bohora

Examples

1
2
3
4
calculate_postfix("2 3 1 * + 9 - ")

expr <- "+ 9 * - 2 5 + 3 2"
evaluate_prefix(expr)

sbohora/Somya documentation built on May 14, 2019, 7:35 a.m.