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
Write a 5 paragraph essay about this virus, who created it, why, what damage did it cause, and did they go to jail. The worst co
zheka24 [161]

The creator of the MyDoom virus is still unknown. This is known to be a worm that was said to have  appeared  in a from of a poorly sent e-mail, and a lot of people who originally were sent the e-mail did ignored it, thought it was a spam and they ignored it and as such, , it was said to have spread to infect about 500 thousand computers in the whole world.

<h3>What does MyDoom virus do?</h3>

The MyDoom virus was said to be the one that brought about a lot of loss in the whole globe.

The  MyDoom is known to be an effective worm that was created to make zombies out of lots of thousands of computers.

Note that the Hackers are able hijacked terminal to wage a kind of  denial of service (DoS) attack to any firm that they do identified.

The virus is known also as Novarg as it is a“worm,” sthat do pread by mass emailing.

Therefore, The creator of the MyDoom virus is still unknown. This is known to be a worm that was said to have  appeared  in a from of a poorly sent e-mail, and a lot of people who originally were sent the e-mail did ignored it, thought it was a spam and they ignored it and as such, , it was said to have spread to infect about 500 thousand computers in the whole world.

Learn more about Virus from

brainly.com/question/14887682

#SPJ1

6 0
2 years ago
Suzanne has inserted an image into her document and would like to adjust the color and contrast of the image.
ch4aika [34]

Answer: I believe it is the second one or third one

Explanation:

8 0
4 years ago
Mecanismo que permite conocer si la persona que esta ingresando a un sistema es realmente quien deba y no un intruso
Tems11 [23]

Answer:

Sistemas de autenticación y seguridad de la información.

Explicación:

La seguridad de la información es un mecanismo que permite saber si la persona que está ingresando a un sistema es realmente quien debería y no un intruso. La seguridad de la información básicamente ayuda a prevenir el acceso no autorizado y permite que la única persona autorizada ingrese al sistema. Los sistemas de autenticación son el mecanismo de seguridad que se utiliza para proteger los datos y los sistemas. Estos sistemas de autenticación también ayudan a garantizar que los usuarios sean la persona autorizada o no.

4 0
3 years ago
Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o
Alex Ar [27]

Answer:

def capitalize_first(st):

   capitilized_list = []

   splitted_st = st.split(". ")

   for x in splitted_st:

       capitilized_list.append(x[0].capitalize() + x[1:])

   capitilized_st = ". ".join(capitilized_list)

   return capitilized_st

 

s = input("Enter a string: ")

print(capitalize_first(s))

Explanation:

Create a function called capitalize_first that takes one parameter, st

Create an empty list that will hold the capitalized strings

Split the given string using split function and put them in the splitted_st

Create a for loop that iterates through splitted_st. For each string in splitted_st, capitalize their first character and put them in the capitalized_list.

When the loop is done, join the strings in the capitalized_list using join function and set the joined string to capitilized_st

Return the capitilized_st

Ask the user for the string

Call the function with entered input and print the result

7 0
3 years ago
Which act requires financial institutions to ensure the security and confidentiality of customer data and mandates that data mus
Shalnov [3]

Answer:

Gramm-Leach-Bliley Act is the correct answer.

Explanation:

8 0
3 years ago
Other questions:
  • Tony Stark wants to build a 1000 meter high tower as quickly as possible. He has unlimited resources and an unlimited budget and
    8·2 answers
  • When date is processed into a meaningful form, i becomes _______.
    12·1 answer
  • A word that has a specific, predefined meaning in a programming language is called
    8·1 answer
  • In the lab, wireshark continued to capture data in the background until the:
    15·1 answer
  • The leader of the team wants to do everything him or herself. They have a very big ego and are difficult to work with. What is t
    14·1 answer
  • What are the step by step instructions on how to rename a document(without opening it) that is filed in my computer/my documents
    9·1 answer
  • How to count how many uppercase letters in sentence in python?
    8·1 answer
  • What is the full form of the OS?​
    15·2 answers
  • What is the result when you run the following program?
    9·2 answers
  • Computer networks that use packet switching are less efficient than telephone networks that use circuit switching.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!