Answer to Question 09A-5

(a) Yes, that is allowed in C++.

(b) No, that is not allowed by the coding standards for this course. You are required to use compound statements, as in the following.

  if(x > 0)
  {
    y = 0;
  }
  else
  {
    y = x - 1;
  }