Respuesta :

Question (continuation):

If the number is greater than 30, the procedure should return the number doubled.

Answer:

The procedure written in C++ is as follows:

void absdiff(int num){

   if(num<=30){

       num = abs(num - 30);

   }

   else{

       num*=2;

   }

   cout<<num;

}

Explanation:

This defines the procedure

void absdiff(int num){

This checks if the integer parameter is not more than 30.

   if(num<=30){

If yes, the absolute difference between 30 and the number is calculated

       num = abs(num - 30);

   }

If otherwise

   else{

The number is doubled

       num*=2;

   }

This prints the processed result

   cout<<num;

}

See attachment for complete program that includes the main

Ver imagen MrRoyal