|
-
May 19th, 2002, 08:32 PM
#1
Thread Starter
New Member
string parsing please help me
i got to take an linear equation from user and i got seperate variables and contants and tight hand side of the equation in seperate arryas
example x1+2y1-3z1=30
arrayconst=(1,2,3)
arrayvar=(x1,y1,z1)
arrayoper=(+,-)
RHS=30
ope="="
any type of variable can come in to the equation
please help
kalyan boinapalli
-
May 19th, 2002, 08:58 PM
#2
Hyperactive Member
can you put in spaces in between the formulae? that would make things a little easy. is the format posted final? no spaces in between?
-
May 19th, 2002, 10:08 PM
#3
Hyperactive Member
does the linear equation always have the same form as you posted before?
does it include only 3 variables as stated before?
pls include more details
-
May 20th, 2002, 08:33 AM
#4
Thread Starter
New Member
thank you
i can put spaces in between ,but the no of variables vary
thanks again
-
May 20th, 2002, 08:38 AM
#5
Thread Starter
New Member
the equation length may vary
any thing can come like x1+x2-y+z>=30
and we can include spaces to seperate different words
-
May 20th, 2002, 08:47 AM
#6
Create an Array containg Variables (a tru z), and an Array containing
Constants (+ , -). Slice the string and loop thru the 2 arrays.
From that build up your three Arrays.
-
May 20th, 2002, 08:48 AM
#7
looks like a compiler
are you gonna consider the bad users that put something like "xy++"?
maybe you can create an array of invalid values, constants, and operators. then all you have to do is read char by char and look for it in an array.
if its in the invalid values you can raise a message. if its in the constants you can put it in a constants array, you do the same with the rest of the caracters...
damn! i really dont remember how to do that the "by the book" way.... maybe you can look on the web for "compilers". lexical, syntactic and semantical analysis and so on...
sorry if i misspelled some words
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|