Question

3. Write a void functions named Complement that takes two bool arrays and an int as parameters named RA, RB and n respectivel
0 0
Add a comment Improve this question Transcribed image text
Answer #1

void Complement(bool RA[],bool RB[],int n)
{
   //first converting to 1's compelement
   for(int i=0;i<n;i++)
   {
       if(RA[i]==true)
       RB[i]=false;
       else
       RB[i]=true;
   }
   //then converting to 2's complement
   for(int i=0;i<n;i++)
   {
       if(RB[i]==false)
       {
           RB[i]=true;
           break;  
       }  
       else
       {
           RB[i]=false;  
       }
   }
  
}

Add a comment
Know the answer?
Add Answer to:
3. Write a void functions named Complement that takes two bool arrays and an int as parameters named RA, RB and n r...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Write a function named findTarget that takes three parameters: numbers, an array of integers -...

    1. Write a function named findTarget that takes three parameters: numbers, an array of integers - size, an integer representing the size of array target, a number The function returns true if the target is inside array and false otherwise 2. Write a function minValue that takes two parameters: myArray, an array of doubles size, an integer representing the size of array The function returns the smallest value in the array 3. Write a function fillAndFind that takes two parameters:...

  • c++ question need help Write a function pairWise that takes four parameters: two arrays of int...

    c++ question need help Write a function pairWise that takes four parameters: two arrays of int and the size of the first array. The size of the first array is guaranteed to be exactly twice the size of the 2nd array The function takes each pair of integers from the first array and stores the product in the 2nd array. ex: if the first array is {2, 7, 3, 4}, then the second array will end up with {14, 12}

  • c++ question need help Write a function pairWise that takes four parameters: two arrays of int...

    c++ question need help Write a function pairWise that takes four parameters: two arrays of int and the size of the first array. The size of the first array is guaranteed to be exactly twice the size of the 2nd array The function takes each pair of integers from the first array and stores the product in the 2nd array. ex: if the first array is {2, 7, 3, 4}, then the second array will end up with {14, 12}

  • Java arrays Create method named repeatedN that takes two integer parameters named range and n and...

    Java arrays Create method named repeatedN that takes two integer parameters named range and n and returns an integer array Method should return an integer array that has numbers 0 - range repeated in order n times If range is less than or equal to 0; return an array that has 0 repeated n times Create a second method named printArray that takes an integer array as a parameter. The method should print out every element on the same line...

  • In c++ 1. Write a function named findTarget that takes three parameters - numbers: an array...

    In c++ 1. Write a function named findTarget that takes three parameters - numbers: an array of integers size: an integer representing the size of array target: a number The function returns true if the target is inside the array and false otherwise 2. Write a function min Valve that takes two parameters: myArray an array of doubles - size: an integer representing the size of array The function returns the smallest value in the array 3 Wrile a funcion...

  • Define a function called DisplayMax that has 3 parameters: the first two parameters are parallel arrays...

    Define a function called DisplayMax that has 3 parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMax must work when called with various types of actual arguments, for example string DisplayMax(string names[], int calories[], int size) or int DisplayMax(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with the...

  • Write a program that works with two arrays of the same size that are related to...

    Write a program that works with two arrays of the same size that are related to each other in some way (or parallel arrays). Your two arrays must be of different data types. For example, one array can hold values that are used in a formula that produces the contents of the second array. Some examples might be:  from a previous program, populations and the associated flowrates for those populations (an int array of populations and a double array...

  • Language C Code Write a program that takes two integer arrays (A and B) and sums...

    Language C Code Write a program that takes two integer arrays (A and B) and sums them together (element wise). A third array to accept the result should be passed in as the output argument. Assume the arrays are all the same size. The argument N is the size of the arrays. Your code should provide a function with the following signature: void array Addition (int A[], int B[], int N, int output[]) { } Your code must also provide...

  • help ASAP 3. Write a string C++ function named UnsignedPartialSum() that takes two string parameters and...

    help ASAP 3. Write a string C++ function named UnsignedPartialSum() that takes two string parameters and an int parameter. If both string parameters represent binary numbers and the int parameter is equal to a positive number less than or equal to the length of the longest string parameter, the function should return a binary string whose length is equal to two times the length of the maximum length of the two string parameters whose value is equal to the sum...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT