the 2nd type should be similar to the for loop someone suggested.
it's just that type 2 is expanded out.
the reason why I came up with this decision was based on my old source I looked up.
here's a sample of the source using both techniques:
Code:
//type 1
...
cout<<"statement 1";
function(variable_1);
cout<<"statement 2";
function(variable_2);
cout<<"statement 3";
function(variable_3);
cout<<"statement 4";
function(variable_4);
...
versus
Code:
//type 2
...
short unsigned int i;
for( i=1 ; i<=4 ; i++ )
{
cout<<"statement "<<i;
switch(i)
{
case 1: function(variable_1);
case 2: function(variable_2);
case 3: function(variable_3);
case 4: function(variable_4);
}
}
or a slight modification of above:
Code:
//alternate type 2
...
void print(int i)
{
cout<<"statement"<<i;
}
...
print(1);
function(variable_1);
print(2);
function(variable_2);
print(3);
function(variable_3);
print(4);
function(variable_4);
...