Jitendra Kumar

Jitendra Kumar

  • NA
  • 189
  • 22.9k

Write an algorithm using any c#??

Aug 22 2018 7:45 AM
Write an algorithm using any computer language you are most comfortable with to process or evaluate a string that represents a postfix mathematical expression to the correct answer.The postfix expression must support the following Format.
 
expr:--?[0-9]+
  
expr : expr expr (+|-|*|/) 
 
Some of the examples of the postfix expression and their respective results are represented below 
 
 Postfix Expression Result
 11+ 2.0
 2-3* -6.0
 11+23*- -4.0
 10 12+2+5++ 20.0
 
 The input to the algorithm is represented in a text file with each line in the file representing a postfix expression. write a console application that
 
  1. Reads the file line by line 
  2. process each of the line with your algorithm
  3. prints is an evaluation of each line to the console  
  4. typing "q" or reading letter q from input should terminate your console applications.
 
 eG EXAMPLE OF INPUT IS BELOW 
11+
 
22*
 
 
THE CONSOLE APPLICATION PRINTS THE VALUE 
 
2
 
 
FOR RESULTSthat represent a floting-point number. please use the maximum
 
precision available to the platform 
 
 
 

Answers (1)