954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

String Parsing

The user enters the following :

" x+sin(x)-pow(x,2)+5log(x)"

How can I make parsing for a statement like that .

super.mina
Newbie Poster
15 posts since Apr 2009
Reputation Points: 6
Solved Threads: 0
 

Look at the string character by character.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

I did . but I have no Idea .

I have just finished a Course in C and this is the final project .

Can you guide me to some teaching books or helpful websites

super.mina
Newbie Poster
15 posts since Apr 2009
Reputation Points: 6
Solved Threads: 0
 

There are a variety of ways to do this; see these links for some ideas to get you started.

gusano79
Posting Pro
519 posts since May 2004
Reputation Points: 182
Solved Threads: 77
 

Basically this problem is identifying "strings of interest" log / sin / cos / (x)
You use the strtok function to identify the start and end of these kind of strings

abhimanipal
Master Poster
742 posts since Dec 2009
Reputation Points: 114
Solved Threads: 104
 
Basically this problem is identifying "strings of interest" log / sin / cos / (x) You use the strtok function to identify the start and end of these kind of strings

strtok modifies its target string. This is abad thing if you want to search multiple times over several delimiters.

In almost all cases strtok is the wrong tool to use when parsing input.

L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
 

Well I am lost

super.mina
Newbie Poster
15 posts since Apr 2009
Reputation Points: 6
Solved Threads: 0
 

Describe why. Lot's of answers here, and since you finished the course, you must know how to work with arrays. What's your real problem?

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You