# Thread: How to solve simultanious equations...??

1. Intermediate user
Join Date
Feb 2006
Posts
157
Thanks
12
Thanked 1 Time in 1 Post
Qt products

## How to solve simultanious equations...??

Hi guys,

Can any body help me to solve simultaneous equations using C++ ..?
or What should be my approach to solve the simultaneous equations using C++ ...?

For eg: I have the following equations .......

Qt Code:
`6x     +   5y  = 10                   // --------------------( 1 )11x   -   3y  = 75                   // --------------------( 2 )`
To copy to clipboard, switch view to plain text mode

To solve the above 2 equations i need to multiply 3 with equation (1) and multiply 15 with equation (2)
Then i will get the following eqauations ....

Qt Code:
`18x   +    15y  =  30                // --------------------- (3)55x   -     15y  =  75                // --------------------- (4)`
To copy to clipboard, switch view to plain text mode

Now let's solve the equations ( 3, 4 ) and i will get the following outoput.

Qt Code:
`63x =  105   then x  =  105/63 ;`
To copy to clipboard, switch view to plain text mode

Now we got the "x" value . // This is what i need programmatically

So my plan is , in my C++ application i just need to take the first 2 equations ( 1, 2 )as inputs. Please tell me which data structure i need to use to accept/store equations( 1, 2) .
Or How to start with this equations..??

2. ## Re: How to solve simultanious equations...??

Google for Gauss method for solving equations.

Join Date
May 2008
Location
Kyiv, Ukraine
Posts
418
Thanks
1
Thanked 29 Times in 27 Posts
Qt products
Platforms

## Re: How to solve simultanious equations...??

Originally Posted by joseph
Hi guys,

Can any body help me to solve simultaneous equations using C++ ..?
or What should be my approach to solve the simultaneous equations using C++ ...?

For eg: I have the following equations .......

Qt Code:
`6x     +   5y  = 10                   // --------------------( 1 )11x   -   3y  = 75                   // --------------------( 2 )`
To copy to clipboard, switch view to plain text mode

To solve the above 2 equations i need to multiply 3 with equation (1) and multiply 15 with equation (2)
Then i will get the following eqauations ....

Qt Code:
`18x   +    15y  =  30                // --------------------- (3)55x   -     15y  =  75                // --------------------- (4)`
To copy to clipboard, switch view to plain text mode

Now let's solve the equations ( 3, 4 ) and i will get the following outoput.

Qt Code:
`63x =  105   then x  =  105/63 ;`
To copy to clipboard, switch view to plain text mode

Now we got the "x" value . // This is what i need programmatically

So my plan is , in my C++ application i just need to take the first 2 equations ( 1, 2 )as inputs. Please tell me which data structure i need to use to accept/store equations( 1, 2) .
Or How to start with this equations..??

If I'm not mistaken then 55 + 18 is 73.... not 63.. And, Yes, Gauss method will work...