Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

input /output  RSS feed

 
Renuka Prasad prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
Your input will given in a text file (input.txt).
Your program should create an output file (output.txt).
Every line in the file represents a test case for which you should have a corresponding line as result in the output file.

Every line will be a mathematical expression that will be given with braces. The operators that will be used are only +,*,/,- (bodmas priority). The braces that
will be used are [],() (in that order of priority). The program should provide the ouput for each experssion in the output file if the syntax of the expression is
correct. If incorrect syntactically, "invalid" should be written.

Ex:
[1+2*(3+5)/4] => 5
[1+2*(3+5/5] => invalid
[1+2*3/6] => 2
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Where's your code?
 
Renuka Prasad prasad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
i have tried in many simplified ways but didn't came over an exclusive and accurate code for the above program...so please could anyone build the code...that would be a great help.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!