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
Nadusha1986 [10]
3 years ago
5

Discuss a situation in which you might want to use a floating-point number with a fractional part for a loop control variable. W

hat are the pitfalls of using real numbers for the index variable in a for loop?
Computers and Technology
1 answer:
serious [3.7K]3 years ago
7 0

Answer:

1. When calculating the division of each number in some range of floating type number.

2. One cannot use real numbers for exact comparison. Two real numbers are rarely equal. Real numbers are have representational errors.

Explanation:

1. In structured programming, we make use of a floating-point number with a fractional part for a loop control variable. a given scenario is when we just want to calculate the division of each number in some range of floating type number. However, the downsides to using a floating-point number with a fractional part for a loop control variable are:

  • They can cause 'off-by-one' failure
  • A floating point number cannot represent all simple fractions exactly

2. The pitfalls of using real numbers for the index variable in a for loop:

  • Two real numbers are hardly equal
  • One cannot use real numbers for exact comparison
  • The existence of representational errors
You might be interested in
Which best describes the benefits of renting a home
ANTONII [103]
Is it multiple choice or an essay question? If its an essay question I would say Living alone, being able to rent YOU'RE own home, and probably being able to decorate it the way you want. 
5 0
3 years ago
Read 2 more answers
Which of the following attacks is MOST likely the cause when a user attempts to go to a website and notices the URL has changed?
lilavasa [31]

Answer: C) DNS poisoning

Explanation: DNS poisoning or DNS cache poisoning is the type of attacking tendency towards the URL of the computer. These attempt to attack the URL using the spam mails and the user usually end up clicking on the URL provided by the attacker which invokes attack in the computer.

This mechanism takes place in the emails as well as the selected websites which can be accessed by the users easily.These attacks once enter the system seems like the real thing and become prone to many risks .

6 0
3 years ago
Write a program that allows the user to enter a start time and a future time. Include a function named compute Difference that t
Aleonysh [2.5K]

Step 1

Following is the c++ program:

Variables used:

startHours, startMins are used to store the starting time of time machine.

futureHours, futureMins are used to store the future time of time machine.

xAM variable is used to store meridiem of start and future time.

isSAM is boolean variable that is true if starting time is AM.

isFAM is boolean variable that is true if future time is AM.

 

Functions:

main() is used to call computeDifference() function that will calculate the difference between the start and future time.

computeDifference() takes as input six variables from the user and then apply the following logic to compute the difference between the start and future time:

If Meridien of both start and future time are the same, then simply subtract the start time from the future time.

Difference = future minutes – start minutes

If Meridien of both start and future time are different, then apply the following formula to calculate difference:

Difference = (12 * 60 – start minutes) + future minutes

Step 2

Program :

#include <iostream> //header file for input and output

 

using namespace std;

//calculate the time difference(in minutes) between start time and future time.

int computeDifference(int startHours, int startMins, bool isSAM, int futureHours, int futureMins, bool isFAM) {

 int difference = 0; //to store difference

 startMins = startHours * 60 + startMins; //converting in minutes.

 futureMins = futureHours * 60 + futureMins; //converting in minutes.

 //applying formula for difference.

 if (isSAM == isFAM) {

   difference = futureMins - startMins;

 } else if (isSAM == true && isFAM == false) {

   difference = (12 * 60 - startMins) + futureMins;

 }

}

int main() {

 int startHours, startMins; //it will store start time

 int futureHours, futureMins; //it will store future time.

 string xAM; //it will store meridiem.

 bool isSAM; //it will be true if start time is AM.

 bool isFAM; //it will be true if future time is in AM.

 int difference = 0; //it will store difference.

 cout << "Enter start time of time machine as 'HH MM AM/PM': "; //take input from

7 0
3 years ago
3. What is a web directory? What are the key differences between web directories
MrMuchimi

Answer:

web directories are much smaller and more specific than search engines

3 0
1 year ago
The protections from the security software must continue when the device is taken off the network, such as when it is off-grid,
snow_lady [41]

Answer:

third ighjojdudjz

ghddduewjj

wkckdjjj

Explanation:

cchmddkhwmx

ndhdnahdd

jruditndjed

3 0
3 years ago
Other questions:
  • Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a
    8·1 answer
  • For a line segment, show that clipping against the top of the clipping rectangle can be done independently of the clipping again
    7·1 answer
  • There are how many GPS satellites orbiting the earth
    15·1 answer
  • Leah wants to add an image to her updated presentation, so she wants to access the Help interface. What should
    11·2 answers
  • Who initially developed what is now known as the internet?
    5·1 answer
  • Describe a situation in which you have experienced harm as a consequence of a failure of computer security. Was the failure mali
    6·1 answer
  • What makes someone an expert? What potential issues are there with this?
    10·2 answers
  • Write a program to compute the maximum and minimum value of three numbers:
    10·1 answer
  • Designers are comparing performance between a multi-core processor equipped with 16 in-order cores and a dual-core superscalar p
    13·1 answer
  • Suppose that you have declared a numeric array named numbers, and two of its elements are numbers[1] and numbers[4]. You know th
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!