from what i remember last semester a control parameter is a value that is passed which is needed by the module it is passed to or returned to to perform an operation..
eg this..
int calc(int num1, int num2, int num3)
{
num3 = num1 + num2;
return num3;
}
void main()
{
int num1, num2, num3;
cin >> num1;
cin >> num2;
cin >> num3;
calc(num1, num2, num3);
cout << num3;
}
in this code num1 2 and 3 are parameters which are passed to the module calc and are added and stored in num3 then it is passed back and displayed. This shows no use of control parameters because the parameters passed do not control the way the program runs..
and now for an example with control parm passing
ing validate(int num1, int num2, int num3)
{
//some crap to check if its valid numbers
return valid; //this will return a 0 if it is invalid and a 1 if it is valid
}
int calc(int num1, int num2, int num3)
{
num3 = num1 + num2;
return num3;
}
void main()
{
int num1, num2, num3, valid;
cin >> num1;
cin >> num2;
cin >> num3;
validate(num1, num2, num3);
if(valid==1)
{
calc(num1, num2, num3);
cout << num3;
} else {
cout << "invalid number(s)";
}
}
this is basily the same as the above but this time it passes the paramters to a validation module which will check if the numbers are valid, when they are valid it will return a 1 and when they are not valid a 0. The variable valid is a control paramter and it is passed back to the mainline, as you can see it actualy has some effect on the control of the program by the if-else statement..
hope it helps..