Naming the variables the letter names doesn't really help anything. I would create a vector of pairs: std::vector<std::pair<char, int> > or something like that to keep the letters attached to their current value. I don't know what you're doing with all of the multiplying by 4 and modding by 10 business? (Comment, comment, comment!) You also haven't showed how the input is provided? It it that string? (TOO + ... )? If so, you'll first have to parse and figure out where the + symbols are. Then you can convert the individual "words" to numbers by doing string "find and replace" (http://www.java2s.com/Code/Cpp/Data-Type/StringFindandreplace.htm) then you can convert to an int using a stringstream: http://programmingexamples.net/index.php?title=CPP/StringStream

Phew, looks like you've got a lot of work to do! Good luck!

David

Assume each letter (ie, char) in TOO and GOOD is a digit. The value of the digit is stable for each occurrence of the letter in the equation. Since there are 4 TOOs on the right hand side of the = operator the original equation is the same as 4 * TOO = GOOD. This statement has only 4 unique char so you can use 4 loops, one to represent each unique char in the statement. Each loop will range from 0-9, so rather than using type char you can use the char representation as the variable name for an int. Once you have a digit value for a given char you can change TOO and GOOD into a numeric value and test out the equation. If the equation is true for other than the trivial value of zero for T, O, G, and D, then you have found something interesting. Who knows, there may be more than one non-trivial solution or there may not be any values of T, O, G and D that satisfy the equation as given.

```
//use A for O so you don't get confused between capital oh and zero
int TAA = 0;
int GAAD = 0;
for int A = 0; A < 10; ++A
for int T = 0; T < 10; ++T
//do dah
//do dah
//calculate value of TAA
TAA = (1 * A) + (10 * A) + (100 * T);
//calculate value of GAAD
//check if equation is correct
//print something cute if it is
```