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
Nat2105 [25]
3 years ago
14

. Write a function definition as follows: it returns the C++ form of a Boolean value, its function identifier is anyTwoTheSame,

it has three formal parameters which all are floating-point values, and the body of the function returns true if any two of the parameters are equal, otherwise it returns false. I recommend using short, simple identifiers for the three formal parameters.
Computers and Technology
1 answer:
Paraphin [41]3 years ago
3 0

Answer:

The c++ code to implement the Boolean function is given. The function definition is shown.

bool anyTwoTheSame(float a, float b, float c)

{

   bool same = false;    

   if(a == b)

       same = true;

   else if(a == c)

       same = true;

   else if(b == c)

       same = true;        

   return same;

}

Explanation:

This function accepts three floating point numbers and returns true if any two numbers are equal else returns false.

The program below shows the implementation of this method.

#include <iostream>

using namespace std;

bool anyTwoTheSame(float a, float b, float c);

bool anyTwoTheSame(float a, float b, float c)

{

   bool same = false;    

   if(a == b)

       same = true;

   else if(a == c)

       same = true;

   else if(b == c)

       same = true;        

   return same;

}

int main() {    

   float one=12.34, two=56.78, three=90.1;    

   cout<<"Two numbers are same : " <<anyTwoTheSame(one, two, three);

}

OUTPUT

Two numbers are same : 0

The method is first declared.

bool anyTwoTheSame(float a, float b, float c);

Next step is method definition which shows what the function is supposed to do. The test to check equality of two numbers is implemented as shown.

bool same = false;    

if(a == b)

       same = true;

   else if(a == c)

       same = true;

   else if(b == c)

       same = true;  

This is the simplest test which can be programmed.

If the numbers are not same, the Boolean variable, same, remains initialized to false.

This function is then called in main method.

No user input is taken as this is not specified in the question.

The three floating variables are declared and initialized inside the main. The values are put inside the program and not taken from the user.

The output shows either 0 or 1. 0 represents false and 1 represents true.

This program can be tested for different values of floating variables.

You might be interested in
There are two common computer platforms for both PC and MAC users. Which term best describes this function?
andrezito [222]

Operating system (OS)

5 0
3 years ago
Which professional can film projects hire as part of their budgeted costs? You can hire special ____ lawyers and include their f
gregori [183]
This is clearly A it is not that hard
3 0
3 years ago
Assume x represents an integer number, what is the highest index value in the following array? byte[] values = new byte[x]; Grou
scoundrel [369]

Answer:

You forgot to add a group of choices, however assuming this programming language uses 0-based indexes the answer would be x - 1

Explanation:

Zero based index languages have array indexes starting at 0. When you create that array, you use x to define the amount of elements, however due to the array starting at the index 0, the arrays highest index would be x - 1 instead of x.

4 0
2 years ago
An alternate method to open the word count dialog is to click _______ on the status bar at the bottom of the word window
kondor19780726 [428]

An alternate method to open the word count dialog is to right click the blue portion on the status bar at the bottom of the word window.  The status Bar will roll down showing different functions including WORD COUNT. Click WORD COUNT and it will show up on the bottom left with the count of words you have written.

7 0
4 years ago
[Assembly Language]Extended Subtraction Procedure.Create a procedure named Extended_Sub --(Receives: ESI and EDI point to the tw
alex41 [277]

Answer:

Modern (i.e 386 and beyond) x86 processors have eight 32-bit general purpose registers, as depicted in Figure 1. The register names are mostly historical. For example, EAX used to be called the accumulator since it was used by a number of arithmetic operations, and ECX was known as the counter since it was used to hold a loop index. Whereas most of the registers have lost their special purposes in the modern instruction set, by convention, two are reserved for special purposes — the stack pointer (ESP) and the base pointer (EBP).

For the EAX, EBX, ECX, and EDX registers, subsections may be used. For example, the least significant 2 bytes of EAX can be treated as a 16-bit register called AX. The least significant byte of AX can be used as a single 8-bit register called AL, while the most significant byte of AX can be used as a single 8-bit register called AH. These names refer to the same physical register. When a two-byte quantity is placed into DX, the update affects the value of DH, DL, and EDX. These sub-registers are mainly hold-overs from older, 16-bit versions of the instruction set. However, they are sometimes convenient when dealing with data that are smaller than 32-bits (e.g. 1-byte ASCII characters).

When referring to registers in assembly language, the names are not case-sensitive. For example, the names EAX and eax refer to the same register.

Explanation:

5 0
3 years ago
Other questions:
  • Key Categories: more libraries and thousands of functions
    7·1 answer
  • The manufacturer doesn't need it the buyer doesn't want it the user doesn't know they're using it
    6·1 answer
  • Write a class named RetailItem that holds data about an item in a retail store. The class should store the following data in att
    15·1 answer
  • Array is special variable that can handle more than one value.
    6·1 answer
  • Suction cup-type headlamp aiming equipment may be used on:
    11·1 answer
  • As discussed in the video, parallax measurements allow us to calculate distances to stars for which parallax is detectable. Supp
    14·1 answer
  • The following are the CPU and I/O behavior of three processes, timings in seconds.
    9·1 answer
  • Use the drop-down menus to answer questions about the options in the Window group. Which command allows a user to view presentat
    6·2 answers
  • Describe how operating system use the following security tools: firewall, automatic updating, antivirus software, spyware and ma
    11·1 answer
  • On React
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!