Driver program to test above function
static void Main ( ) { string expr1 = "1 + 2*5 + 3" ; int res = evaluate ( expr1 ) ; if ( res == - 1 ) Console . WriteLine ( expr1 + " ▁ is ▁ Invalid " ) ; else Console . WriteLine ( " Value ▁ of ▁ " + expr1 + " ▁ is ▁ " + res ) ; string expr2 = "1 + 2*3" ; res = evaluate ( expr2 ) ; if ( res == - 1 ) Console . WriteLine ( expr2 + " ▁ is ▁ Invalid " ) ; else Console . WriteLine ( " Value ▁ of ▁ " + expr2 + " ▁ is ▁ " + res ) ; string expr3 = "4-2 + 6*3" ; res = evaluate ( expr3 ) ; if ( res == - 1 ) Console . WriteLine ( expr3 + " ▁ is ▁ Invalid " ) ; else Console . WriteLine ( " Value ▁ of ▁ " + expr3 + " ▁ is ▁ " + res ) ; string expr4 = "1 + + 2" ; res = evaluate ( expr4 ) ; if ( res == - 1 ) Console . WriteLine ( expr4 + " ▁ is ▁ Invalid " ) ; else Console . WriteLine ( " Value ▁ of ▁ " + expr4 + " ▁ is ▁ " + res ) ; } }