Click here to Skip to main content
15,896,118 members
Home / Discussions / C#
   

C#

 
AnswerRe: about static keyword. Pin
PIEBALDconsult20-Jul-11 14:20
mvePIEBALDconsult20-Jul-11 14:20 
GeneralRe: about static keyword. Pin
*DBAU21-Jul-11 2:27
*DBAU21-Jul-11 2:27 
AnswerRe: about static keyword. Pin
Richard MacCutchan20-Jul-11 22:27
mveRichard MacCutchan20-Jul-11 22:27 
GeneralRe: about static keyword. Pin
*DBAU21-Jul-11 2:30
*DBAU21-Jul-11 2:30 
AnswerRe: about static keyword. Pin
Shameel21-Jul-11 2:26
professionalShameel21-Jul-11 2:26 
GeneralRe: about static keyword. Pin
*DBAU21-Jul-11 2:28
*DBAU21-Jul-11 2:28 
QuestionChemical Equation Balance Pin
stephen.darling20-Jul-11 7:54
stephen.darling20-Jul-11 7:54 
AnswerRe: Chemical Equation Balance Pin
Ian Shlasko20-Jul-11 8:07
Ian Shlasko20-Jul-11 8:07 
Well, when you're balancing a chemical equation, all you're really allowed to do (If I remember my high school chemistry) is adjust the amount of each component, right?

So I think you need to do this in a recursive loop with three main steps:

Step 1: Figure out the amount of each individual element, subtract the two sides, and see how much you have to add on each side to balance it.

Step 2: Pick one of these imbalances and figure out which terms contain that element. Prioritize terms based on how many other elements they affect (If you need to increase Hydrogen, prioritize the H2 term above the H2SO4 term).

Step 3: For each of these terms (In order of priority), increase the amount of that term to counter the imbalance, then repeat this process with the modified equation (Using recursion, so you come back to try a different term if it fails).


There's probably a better way, but this is the first one that popped into my mind.


Example:

H2 + O2 = H2O

1) 2H + 2O = 2H + O.... Subtract and you see you need another O on the right side

2) There's only one term that contains O on the right (Only one term, period)

3) Increase H2O to 2H2O to add one more O. New equation is H2 + O2 = 2H2O...

1a) 2H + 2O = 4H + 2O... Subtract, and you now need 2H on the left side

2a) Only one term contains it (H2)

3a) Increase that to 2H2 to get the extra two hydrogens. New equation is 2H2 + O2 = 2H2O

1b) 4H + 2O = 4H + 2O... Subtract, and it's balanced, so return it.


Obviously a simple example.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

GeneralRe: Chemical Equation Balance Pin
stephen.darling20-Jul-11 8:11
stephen.darling20-Jul-11 8:11 
GeneralRe: Chemical Equation Balance Pin
Ian Shlasko20-Jul-11 8:25
Ian Shlasko20-Jul-11 8:25 
GeneralRe: Chemical Equation Balance Pin
secorbett21-Jul-11 2:34
secorbett21-Jul-11 2:34 
AnswerRe: Chemical Equation Balance Pin
Chris Losinger20-Jul-11 9:48
professionalChris Losinger20-Jul-11 9:48 
AnswerRe: Chemical Equation Balance Pin
Keith Barrow20-Jul-11 10:47
professionalKeith Barrow20-Jul-11 10:47 
GeneralRe: Chemical Equation Balance Pin
David198720-Jul-11 11:27
David198720-Jul-11 11:27 
GeneralRe: Chemical Equation Balance Pin
Luc Pattyn20-Jul-11 14:31
sitebuilderLuc Pattyn20-Jul-11 14:31 
GeneralRe: Chemical Equation Balance Pin
Richard Andrew x6420-Jul-11 15:07
professionalRichard Andrew x6420-Jul-11 15:07 
GeneralRe: Chemical Equation Balance Pin
Luc Pattyn20-Jul-11 15:28
sitebuilderLuc Pattyn20-Jul-11 15:28 
GeneralRe: Chemical Equation Balance Pin
stephen.darling21-Jul-11 2:50
stephen.darling21-Jul-11 2:50 
GeneralRe: Chemical Equation Balance Pin
David198721-Jul-11 3:06
David198721-Jul-11 3:06 
GeneralRe: Chemical Equation Balance Pin
stephen.darling21-Jul-11 4:08
stephen.darling21-Jul-11 4:08 
AnswerRe: Chemical Equation Balance Pin
dasblinkenlight20-Jul-11 16:26
dasblinkenlight20-Jul-11 16:26 
GeneralRe: Chemical Equation Balance Pin
stephen.darling21-Jul-11 2:51
stephen.darling21-Jul-11 2:51 
AnswerRe: Chemical Equation Balance Pin
Ennis Ray Lynch, Jr.21-Jul-11 3:45
Ennis Ray Lynch, Jr.21-Jul-11 3:45 
QuestionO'Reilly Confused me on classes Pin
Herboren20-Jul-11 6:47
Herboren20-Jul-11 6:47 
AnswerRe: O'Reilly Confused me on classes Pin
PIEBALDconsult20-Jul-11 7:04
mvePIEBALDconsult20-Jul-11 7:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.