I'm trying to solve a cryptarithmetic puzzle TOO + TOO + TOO + TOO = GOOD using a 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. For example, it might first try T = 0, O = 0, G = 0, D = 0, then T = 0, O = 0, G =0, D = 1, then T = 0, O = 0, G = 0, D = 2, etc. up to T = 9, O = 9, G = 9, D = 9.
. #include<iostream>
using namespace std;
int main()
{
int o=0;
int d=0;
int t=0;
int g=0;
{
for(o=0;o<10;o++)
{
(4*o)%10 = d;
carryFirstCol = (4*o)/10;
if (d!=o)
{
if (((4*o)+carryFirstCol)==o)
{
carrySecondCol = ((4*o)+carryFirstCol)%10;
for (t
}
return 0;
}
I have that much done.. Now i dont kno how to write the if statment to add up the ts to get the o and then finally the g