
Patrick B. answered 01/14/21
Math and computer tutor/teacher
1) Decision control structure, a.k.a. SELECTION statement
executes a block of code if the condition is true....
otherwise executes the alternative block of code
there is also a Selection structure
Select/switch (var)
case value1,value2,value3:
statements
case value A,value B, value C:
statements
endSelect
2)
Ex.
Integer x=0
(inputs integer between 1 and 10)
while (x<1) or (x>10)
output "Please input the number :>"
input x
endwhile
select/switch (x)
case 1,2,3:
output ("LOW");
case 4,5,6:
output("MEDIUM");
case 7,8,9:
output("HIGH");
case 10:
output("WOW!");
other: (<--- should not happen )
output("Huh?");
end select/switch
3)
A Function is a type of Module that can accept
one or more input parameters and returns a single
value to the caller
4)
double function Add( double num1, double num2)
{
return(num1+num2);
}
double function Subtract( double num1, double num2)
{
return(num1-num2);
}
double function Multiply( double num1, double num2)
{
return(num1*num2);
}
double function Divide( double num1, double num2)
{
if (num2 not zero)
{
return(num1/num2);
}
}