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
Create a single line comment that says ""Print results to screen""
levacccp [35]

Answer:

//""Print results to screen""

Explanation:

In c,c++,java,javascript // is used for the single line comment.

syntax:- // comment.

Whatever text that is followed after // is commented means this line will not get executed by the compiler.

Comments are used to explain the code to other person who is working on the code or trying to understand that code.

6 0
3 years ago
Give a recursive version of the algorithm Insertion-Sort (refer to page 18 in the textbook) that works as follows: To sort A[1..
Inga [223]

Answer:

see explaination

Explanation:

void insertion( int e,int *x, int start, int end)

{

if (e >= x[end])

x[end+1] = e;

else if (start < end)

{

x[end+1] = x[end];

insertion(e, x, start, end-1);

}

else

{

x[end+1] = x[end];

x[end] = e;

}

}

void insertion_recurssion(int *b, int start, int end)

{

if(start < end)

{

insertion_sort_recur(b, start, end-1);

insertion(b[end], b, start, end-1);

}

}

void main()

{

insertion_recurssion(x,0,5);

}

3 0
2 years ago
Mirrors on cars exist to
Ghella [55]

Answer:

Mirrors exist on cars so objects behind or to the side of the vehicle are brought into the driver's view. (such as cars, bicyclists, etc.) These spots are normally referred to as "blind spots", which are locations outside of the driver's peripheral vision that are difficult to see.

8 0
2 years ago
Which of the following is a bullet type in the &lt;ul&gt; tag?
dybincka [34]

Answer:

That would be (d) All of these. I hope this helps you!

8 0
2 years ago
__________ is a special place on the hard drive where items from memory can be temporarily stored for fast retrieval
andrew-mc [135]
The answer is swap file 
6 0
3 years ago
Read 2 more answers
Other questions:
  • A program called the ______ combines the object program with other programs in the library and is used in the program to create
    5·1 answer
  • Together, what do the divisions of the DHSMV do?
    12·1 answer
  • How can I change it to accepted file types: .ppt, .pptx, .xls, .xlsx, .doc, .docx, .zip, .pdf, .accdb, .msg on Inkscape?
    15·2 answers
  • Security controls are measures taken to protect systems from attacks on the integrity, confidentiality, and availability of the
    12·1 answer
  • Computer crimes are a big concern since the creation of innovative technological advances; which is/are examples of computer cri
    13·2 answers
  • **NEED HELP??!! Computer Science Questions!! KNOWING GIMP!!!!
    7·1 answer
  • PLEASE HELP!! WILL MARK BRAINLIEST!!
    15·1 answer
  • Write a application that can determine if a 5 digit number you input is a palindrome. If the number is a palindrome then print "
    14·1 answer
  • What is file management?can please help me​
    14·2 answers
  • Define a function below, filter_out_strs, which takes a single argument of type list. Complete the function so that it returns a
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!