I am trying to write a math engine. The problem I've encountered is that if a user enters say:

add(12345,12345)

then how do I know how many digits to read.

Any solutions?

Printable View

- 04-22-2009PoincareSearching within strings
I am trying to write a math engine. The problem I've encountered is that if a user enters say:

add(12345,12345)

then how do I know how many digits to read.

Any solutions? - 04-22-2009bithub
You read until there are no more digits left to read. isdigit() would be a helpful function in parsing this out.

- 04-22-2009quzah
You could use some fancy sscanf work if they're going to be using a standard format.

<operator><paren><op1><,><op2><paren>

Quzah. - 04-24-2009edwardtisdalehuh?
It seems to me that if you are inputting strings you will want to worry about this, but why wouldn't you use floats or ints or something else that isn't a string for your input?

- Edward