![aaron2113](/avatars/25965.jpg)
aaron2113
13.07.2020 •
Computers and Technology
Assume the int variables width and height have been defined. Write a statement that uses a relational expression to determine whether the variables are equal, and then stores the result of the expression in a bool variable named isSquare.
Solved
Show answers
More tips
- A Animals and plants What Do Terriers Eat?...
- F Food and Cooking Discover the Benefits and Properties of Dates...
- C Computers and Internet Dynamically Assigned IP Address: What Is It and How Does It Work?...
- S Style and Beauty How to Get Rid of Acne: Scientifically Proven Methods...
- H Health and Medicine Simple Ways to Lower Cholesterol in the Blood: Tips and Tricks...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
- S Style and Beauty How to Choose the Perfect Hair Straightener?...
Answers on questions: Computers and Technology
- M Mathematics I didn t pay attention today...
- M Mathematics What is 10x10x10 pls help me...
- B Business Zachary myers is a forensic scientist. his monthly salary is $4,397. zachary s annual salary is $ (enter only the amount to the nearest cent....
- H History Which statement accurately describes the underground railroad? a. it guided slave hunters with captured runaway slaves on their return voyage. b. it relied on safe houses run by...
- G Geography Add me fortnite TTV SWATH or swathingslinky7...
Ответ:
bool isSquare = (width == height) ? true : false;
Explanation:
The code above has been written using C++ language.
Assumptions and notes:
i. The width and height variables have been defined.
ii. The conditional operator ? : is used
The format of the conditional operator ? : is as follows;
(expression) ? xxx : yyy
Where;
==> expression is the condition to test. In this case whether width and height are equal. i.e width == height
==> xxx is the returned value or function if the expression is true. In our case, the value is the boolean true.
==> yyy is the returned value or function if the expression is false. In our case, the value is the boolean false.
And finally;
The returned value is assigned to a bool variable called isSquare
Putting all these together gives;
bool isSquare = (width == height) ? true : false;
Ответ:
Output - Monitor, printer, speakers.
Input - Keyboard, mouse, microphone