Convert string to command line/ equation

S

Snowraider

Guest
Hi everyone,

I am currently working on a math game where the player can insert equations and the game draws them (like x^2+5x+2). For that purpose I need to somehow convert the inserted equation from a string to something you can calculate with. Any ideas?
 

ZeDuval

Member
Split the source-string into substrings on space and operators like +, write a few switch/cases to get the type of operators, use string_digits() & string_letters() to differentiate...stuff, and turn string values into real values by using real().
 
Top