1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Basile [38]
3 years ago
9

Write an expression that will cause the following code to print "Equal" if the value of sensorReading is "close enough" to targe

tValue. Otherwise, print "Not equal". Ex: If targetValue is 0.3333 and sensorReading is (1.0/3.0), output is: Equal
Computers and Technology
1 answer:
natali 33 [55]3 years ago
5 0

Answer:

The C++ code is given below with appropriate comments

Explanation:

//Remove this header file if not using visual studio.

#include "stdafx.h"

//Include the required header files.

#include <iostream>

//Use for maths function.

#include <cmath>

using namespace std;

//Define main function

int main()

{

      // Define the variables

      double targetValue = 0.3333;

      double sensorReading = 0.0;

      //Perform the opeartion.

      sensorReading = 1.0 / 3.0;

      // Get the absolute floating point value and

      // Check up to 4 digits.

      if (fabs(sensorReading - targetValue) < 1E-4)

      {

             //Print equal if the values are close enough.

             cout << "Equal" << endl;

      }

      else

      {

             //Print not equal if the values are not                  

             //close enough.

             cout << "Not equal" << endl;

      }

      system("pause");

      //Return the value 0.

      return 0;

}

You might be interested in
ASAP!!!!****** Need help!!!!
m_a_m_a [10]
I think it's right. 
<span>Text, numbers, graphics, or sound represented by discrete digits, such as 1s and 0s.</span>
6 0
3 years ago
An effective problem statement ensures that
swat32
The software design effectively addresses the issues
6 0
3 years ago
A(n) Answer display color uses the least electricity when compared to any other color.
Elan Coil [88]

Is there answer choices because I’m not understanding what you want me to answer

3 0
3 years ago
For which product would the producer keep a high profit margin and offer after-sales service?
Zina [86]

What are the products?

6 0
3 years ago
Scenario: As you walk into an empty class, you see a bag on the floor under the desk what will you do next
Keith_Richards [23]
I'm not sure on what you mean by this however lets say that it may contain a device, when entering DO NOT TOUCH ANYTHING, there are different methods on how a device could be triggered either from light switches or by trip wire which its best to leave the facility over all however lets say you cannot then stop listen for any ticking if not then have a flash light, if the room lights are turned off leave them off use a flash light but be careful where you shine it there could be light sensors on the device that trigger when a light hits it hence why the lights are off. when having a flash light you could be able to see a glare of a wire which could be a trip wire. there are many possibilities in how the device was made from timers, trip wire, sound,light,pressure, switches, electronic waves from phones may effect the device and could activate it as well. But anyways this is all a factor and its best to be careful and if able evacuate if the device is in a weird location at a odd time you know its not suppose to be there, and or items moved that are never moved and if it is never moved then there is dust that could have a odd shape like a hand print. Anyways im not sure if your looking for this type of answer but its good to know!
5 0
3 years ago
Other questions:
  • What is the name of the feature that can be enabled on slower-speed WAN links to prevent a large data transfer from affecting th
    10·1 answer
  • Which of the following is true regarding packaged software and custom software? Group of answer choices Packaged software are ap
    13·1 answer
  • How are modern computers different from eniac?
    5·1 answer
  • Select the answer that best describes the activity
    5·2 answers
  • What are the four types of technical drawing?​
    9·1 answer
  • What did major networks do to combat audience erosion in the 1990s?
    15·1 answer
  • What is Brainly?<br><br> A.Yes<br> B.No
    12·2 answers
  • Importance of type casting in programming ​
    5·1 answer
  • An animation of a person standing with their arms extended out to their sides. There are 3 dimensional boxes around the torso of
    5·1 answer
  • Determine whether the compound condition is True or False.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!