If the input is negative, make numItemsPointer be null. Otherwise, make numItemsPointer point to numItems and multiply the value to which numItemsPointer points by 10. Ex: If the user enters 99, the output should be:

Answer :

Answer:

The code for the given statements are described below.

Explanation:

// Place code below in line 9

if(numItems < 0)  // starting of a loop

{

numItemsPointer = NULL;

}

else  

{

numItemsPointer = &numItems;

numItems = numItems * 10;   // items multiplied by 10

}   // ending of a loop

MrRoyal

The program is an illustration of if conditional statement.

The required code segment (with comments) in C++ is as follows:

//If numItems is less than 0

if(numItems < 0) {

//This sets numItemsPointer to NULL

   numItemsPointer = NULL;

//This displays "Negative Item" to the user screen

   printf ("Negative item");

}

//If otherwise

else  {

//This points numItems to the pointer (numItemsPointer)

   numItemsPointer = &numItems;

This multiplies numItems by 10

   numItems *= 10;

//This prints numItemsPointer

  printf("Items: %d", *numItemsPointer);

}

  • The if conditional statements are used to execute statements based on certain condition(s)
  • If the condition is true, the statement is executed
  • If otherwise, the statement is not executed.

Read more about similar programs at:

https://brainly.com/question/15279209

Other Questions