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

Please support our C++ advertiser: Intel Parallel Studio Home
View Poll Results: do you need this post
ya 1 25.00%
i guess 0 0%
no 3 75.00%
Voters: 4. You may not vote on this poll

Reply

Join Date: Jul 2005
Posts: 41
Reputation: jasondrey13 is an unknown quantity at this point 
Solved Threads: 0
jasondrey13's Avatar
jasondrey13 jasondrey13 is offline Offline
Light Poster

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

 
0
  #1
Aug 11th, 2005
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="<<x<<;
cout<<"y="<<y<<;
cout<<"z="<<z<<;


thx,

Jason
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

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

 
0
  #2
Aug 11th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 41
Reputation: jasondrey13 is an unknown quantity at this point 
Solved Threads: 0
jasondrey13's Avatar
jasondrey13 jasondrey13 is offline Offline
Light Poster

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

 
0
  #3
Aug 11th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

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

 
0
  #4
Aug 11th, 2005
And what is "2 *= x -= 3 *= y = == 4" suppose to mean? This is completely nonsensical notation.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 244
Reputation: Drowzee is an unknown quantity at this point 
Solved Threads: 5
Drowzee Drowzee is offline Offline
Posting Whiz in Training

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

 
0
  #5
Aug 11th, 2005
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".
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 41
Reputation: jasondrey13 is an unknown quantity at this point 
Solved Threads: 0
jasondrey13's Avatar
jasondrey13 jasondrey13 is offline Offline
Light Poster

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

 
0
  #6
Aug 11th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,699
Reputation: Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all 
Solved Threads: 273
Lerner Lerner is offline Offline
Posting Virtuoso

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

 
0
  #7
Aug 11th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 41
Reputation: jasondrey13 is an unknown quantity at this point 
Solved Threads: 0
jasondrey13's Avatar
jasondrey13 jasondrey13 is offline Offline
Light Poster

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

 
0
  #8
Aug 13th, 2005
thx ill try that
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

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

 
0
  #9
Aug 13th, 2005
To find values x, y, z for equations
  1. ax + by + cz = r
  2. dx + ey + fz = s
  3. gx + hy + iz = t

You could 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)
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 41
Reputation: jasondrey13 is an unknown quantity at this point 
Solved Threads: 0
jasondrey13's Avatar
jasondrey13 jasondrey13 is offline Offline
Light Poster

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

 
0
  #10
Aug 13th, 2005
i got it thx
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC