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

hi i have a question!!!!!! (^o^)

hi i need to make a homework helper for 3 equasions 3 unknowns
that will ask me what the equasions are and calculate what the unknowns are i thoght i would ask what the first char was a number or a letter and if it was a number it would store it in an int if it was a letter it would store it on a string...............

is there an and thing so i could tell the computer like

x += y += z == 12 AND
2 *= x -= 3 *= y = == 4 AND
y += z -= x == 2

cout<<"x="<

jasondrey13
Light Poster
41 posts since Jul 2005
Reputation Points: 16
Solved Threads: 0
 

Of the syntax you used to state the problem and the syntax in your sample input, I'm not sure which makes the least sense.

You could be helpful and explain your problem better. Using sentences. Right now, I'm thinking that _maybe_ you're trying to solve a three-by-three linear system. And "2 *= x -= 3 *= y = == 4" makes no sense whatsoever.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 176
 

is there a way to name the value of variables like:

x += y += z == 12 AND (or whatever the operator is)
2 *= x -= 3 *= y = == 4 AND (or whatever the operator is)
y += z -= x == 2

jasondrey13
Light Poster
41 posts since Jul 2005
Reputation Points: 16
Solved Threads: 0
 

And what is "2 *= x -= 3 *= y = == 4" suppose to mean? This is completely nonsensical notation.

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 176
 

Looks like it's trying to be linear algebra.

But just to be sure:
Jasondrey13, is this what you want to solve?

x +y + z = 12;
(2 * x) - (3 * y) = 4
y + z - x = 2

Currently, you're trying to put things into code that aren't correct. The conversion from regular equations to C-style equations is not "Add an equal sign after every operation symbol".

Drowzee
Posting Whiz in Training
245 posts since Jul 2005
Reputation Points: 22
Solved Threads: 5
 

haha ok i dont know a way to tell the computer in c++

set x AND y AND z using these equasions

is there a way to do that or am i asking the impossible and if there is can you please tell me thx

jasondrey13
Light Poster
41 posts since Jul 2005
Reputation Points: 16
Solved Threads: 0
 

It's not impossible to solve the system of three equations with three unknowns using C/C++ but it isn't trivial either. The options to do it using a computer running a program written in C/C++ would be essentially the same as if you were doing it by hand, with the syntax adjusted as appropriate for the computer language as opposed to the mathematical language. Is there a standard function/library you could use to do this? I doubt it very much. Could you write your own? Sure, but it's going to require a lot of work. Could you scour the internet and find a third party library to do it for you? Quite possibly. I'm sure somebody has converted the pen and paper process into C/C++, but whether you'll be able to find a version of that program/algorithm on the internet is open to speculation, and it's not likely someone here is going to write this type of program for you.

No matter how you do it, at some point you will likely need some mechanism to separate the variable coefficients from the variables per se'. Depending on your restaints, you could ask the user to input this data for you or you could accept the equations as strings and parse out the various system variables, coefficients, and constants.

Once you have the vrarious coefficients, variables, and constants isolated, you probably already know that you can solve this type of system of equations using

1) linear algebra and matrixes or
2) isolate x in terms of y and z using equation 1, then y in terms of z in equation 2, and finally solve for z using equation 3 and the appropriate substitutions or
3) some other technique.

Once you've devised ways to isolate the information needed and determined the algorithm you are going to use, then you can start thinking about how to write the code.

Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396
 

thx ill try that

jasondrey13
Light Poster
41 posts since Jul 2005
Reputation Points: 16
Solved Threads: 0
 

To find values x, y, z for equations

ax + by + cz = r
dx + ey + fz = s
gx + hy + iz = t


Youcould use the formulas

x = (e*i - f*h) * r / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h) - (b*i - c*h) * s / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h) + (b*f - c*e)*t/(g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h)

y = -(-g*f + d*i)*r / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h) + (-g*c + a*i)*s / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h) - (-d*c + a*f)*t / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h)

z = (-g*e + d*h)*r / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h) - (-g*b + a*h)*s / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h)+( - d*b + a*e)*t / (g*b*f - g*c*e - d*b*i + d*c*h + a*e*i - a*f*h)

Rashakil Fol
Super Senior Demiposter
Team Colleague
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 176
 

i got it thx

jasondrey13
Light Poster
41 posts since Jul 2005
Reputation Points: 16
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You