View Full Version : read numbers from a string in C

July 31st, 2013, 02:08 PM
I'm now writing a C program that read 2 line of strings from the screen like this:

2x + 3y = 1
3x + 5y = 2
and judge if the 2 equation is parallel or intersecting.
I know the algorithm but i don't know how to get the coefficient from the equations.
note that the input format may vary like 2*x + 3*y = 1.
need help, thank you!

July 31st, 2013, 03:41 PM
Use regular expressions: http://stackoverflow.com/questions/1085083/regular-expressions-in-c-examples

Regular expression would be something like


(not the full regexp to support all cases... )

August 1st, 2013, 04:06 AM
Also, do you really need to do this in C?