# Thread: simple simple design question

1. ## simple simple design question

I'm going to cut right to the chase and show some code:
Code:
```while(times_value < 11)
{
product = 7 * times_value;
cout << "7 x " << times_value << " = " << product << endl;
times_value++;
}```
Now I know this is a matter of style, but do you think it's better to get right into the processing as I do here with product being given a value at the start? Or.... do it like this...
Code:
```while(times_value < 11)
{
cout << "7 x " << times_value << " = ";
product = 7 * times_value;
cout << product << endl;
times_value++;
}```
Where the info is printed and processed in the same way you would think it out? I know this is a stupid question, I'm just curious what other people think about the order of statements.
-Chap

2. Code:
```while(times_value < 11)
{
cout << "7 x " << times_value << " = " << 7 * times_value << endl;
times_value++;
}```

3. Or:
Code:
```for(; times_value < 11; ++times_value)
{
cout << "7 x " << times_value << " = " << 7 * times_value << endl;
}```

4. while(times_value < 11)
cout << "7 x " << times_value << " = " << 7 * times_value++ << endl;

5. Code:
`for(int t=0;t<11;cout<<"7 x "<<t<<" = "<<7*++t<<'\n');`

6. BTW, it's fun to come up with shorter and shorter code, but in actual code I'd prefer my version - it is cleanest and clearest, IMO. Between your original two versions, the first is better, keep similar stuff together - first the processing, then the output. If later you decide to skip output if the value is not appropriate, then the second will be harder to update because you do partial output before you compute the value.

7. Originally Posted by 7stud
Code:
`for(int t=0;t<11;cout<<"7 x "<<t<<" = "<<7*++t<<'\n');`
nice one... but probably endl would be better...