Friday, 3 October 2014

Write C++ statement to accomplish each of the following: Assign the sum of x and y to z and increment the value of x by 1 after the calculation. Test if the value of the variable count is greater than 10. If it is, print "count is greater than 10." Decrement the variable x by 1 then subtract it from the variable total. Calculate the remainder after q is divided by divisor and assign the result to q. Write this statement two different ways.

Leave a Comment

Solution

  1. z = x++ + y;
  2. if( count > 10 )
           cout << "Count is greater than 10." << endl;
  3. total -= --x;
  4. q %= divisor;
If You Enjoyed This, Take 5 Seconds To Share It