[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-edu-devel
Subject:    [kde-edu-devel] Parser for KMathTool needed
From:       Birgit Schulz <Schulz.B () gmx ! de>
Date:       2002-07-03 11:48:12
[Download RAW message or body]

Hi ... I hope that parser is the right word for what I'm looking for.

Because I've got now holidays, I continued with KMathTool and the menu-part 
parabolas.

To scan the parameters of entered parabola-equations I'm using the C++ command 
sscanf in the following way:

int iPoint1 = sscanf(KRestrictedLineInfo1->text().utf8(), "( %lf | %lf )", 
&x1, &y1);
(example to find the x- and y-coordinate of a given point)

Specially for parabolas the user sometimes need to enter much more 
informations than they are needed.
e.g.: "1*x^2+0*x+0"   instead of   "x^2"

Okay ... it is working, but i'm not so happy with it.
So I ask YOU if you can help me, make it more confortable for the user to 
enter parabola-equations (as one example for me!) in every mathmatical 
regular way.
examples:
"x*x"   instead of   "x^2"
"2*x + x^2"   instead of   "x^2 + 2*x"
... and what else is allowed

The function need to give back the parameter a, b and c of a parabola like 
"a*x^2+b*x+c" and an error-message if the entered equation is not a parabola 
(like 2*x + 1is "only" a line) or if there is an other fault.

As I don't know anything about a parser(???) this example will help the make 
others like this.

Thanks a lot, specially when you can help me!

Birgit Lachner (formerly known as Birgit Schulz ... just married :-)
_______________________________________________
kde-edu-devel mailing list
kde-edu-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-edu-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic