I get equation in the form of a string from the output of a software that I want to modify further. I am no expert in C++ and I am wondering if some expert in C++ at this forum can do this for me.
Pls see the attached Notepad file. The attached file has three examples of string to be modified. Here are the attributes of the string.

a. The string will have ASCII characters in it.

b. The string is a mathematical equation. I will be pasting it into Mathcad after modification.

c. The string has parameters and mathematical operators in it (+,-,*,/,^). Each parameter is seperated from another parameter by at least one space. There is no space in a parameter. So, each parameter starts with a space and ends with a space. The parameters of the string in example 1 are listed in the attached file.

d. If a parameter has square brackets in it [], then the program will take the characters inside the brackets and disregard any character in the parameter outside the brackets. For example, it will modify the first parameter in example 1 "F_X1" as "u". If the parameter has no brackets in it, like the last parameter in example 1 (s^2), then it will take it as is.

e. The format of the string is such that the multiplication sign may be omitted between parameters. If there is no mathematical operator between two adjacent parameters, it should be assumed that the math operator between them is multiplication. So, the program should insert a multiplication sign between them.

f. Then the program will reassemple the string in the form of an equation by appropriately keeping the mathematical operators and the paranthesis in the original expression.

The program should output the "result" as shown for each example in the attached file.

I will appreciate if someone can write a program for me that accomplishes this. Many thanks.

Mark Neil

>I am wondering if some expert in C++ at this forum can do this for me.
No. We help you do your work, we don't do it for you. Please read the rules before posting.

Member Avatar for iamthwee

This is really simple, all you really have to do is ignore the stuff before the operator(space) and the first square bracket.

Simple stuff.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.