I'm trying to solve TOO + TOO + TOO + TOO = GOOD using a c++ program.

My solution to this, is to use a nested loop for each unique letter (in this case T, O, G, D). The loops would systematically assign the digits from 0-9 to each letter.

However the following program gives me the wrong results


Code:
#include <iostream>
using namespace std;

int main() {
   int T, O, G, D;
   for (T=0;T<=9;T++) {
      for (O=0;O<=9;O++) {
         for (G=0;G<=9;G++) {
            for (D=0;D<=9;D++) {
               if ( (T*100 + O*10 + O) * 4 == (G*1000)+(O*100)+(O*10)+D) {
                  cout << "T=" << T << "\nO=" << O << "\nG=" << G << "\nD=" << D << endl;
               }
            }
         }
      }
   }
   cout << "Press <ENTER> to exit. ";
   cin.get();
   return 0;