Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to do the following. Declare three integral, var2 and var3, and

ID: 3790185 • Letter: W

Question

Write a program to do the following. Declare three integral, var2 and var3, and assign any suitable values you want to them Declare a Boolean variable bool 1. Check if var 1 is greater than var2, and assign the result to bool 1 Declare another Boolean variable bool2. Find the difference between var 1 and var2. Check if the difference is greater than 10 and assign the result to bool2. Declare another Boolean variable bool3. Assign the logical OR of bool 1 and bool2 to bool3. Display the value of bool3 using court. Use increment operator to increase var2 by 1. Display the new values of var2. Use decrement operator to decrease var3 by 1. Display the new value of var3.

Explanation / Answer

#include <iostream>
using namespace std;

int main() {
   int var1,var2,var3;
       var1 = 56;
       var2 = 44;
       var3 = 76;
      
       bool bool1;
      
       bool1 = var1>var2;
      
       bool bool2;
      
       bool2 = ((var1-var2 >0)? true:false);
      
       bool bool3;
       bool3 = bool1 || bool2;
      
       cout<<"bool3 = "<<bool3;
      
       var2++;
       cout<<" var2 = "<<var2;
      
       var3--;
       cout<<" var3 = "<<var3;
   return 0;
}

output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote