Question & Answer: Provide the required line of code that is missing from this function……

I need the answer to teh following questions for my c++ course:

1.

Provide the required line of code that is missing from this function.

int divide (int a, int b=2)
{
  int r;
  r=a/b;
 //missing statement goes here
}

2. You have the following struct defined in the private area of your class called myClass:

struct database {
int id_number;
int age;
float salary;
};

Your class has a member function called setID that is implemented below. Provide the missing line of code to set the struct’s id_number variable equal to the value passed to this function when it is called.

void myclass::setID(int id)
{
    database employee;
    _______________________
}

Note: Do not put spaces in your answer.

3. The binary search is fast and reliable whether the dataset is sorted or unsorted.

True
False

Expert Answer

 

1. int divide (int a, int b=2)

{
  int r;
  r=a/b;
 return r;// This value will go where the divide function called
}

3. The binary search is fast and reliable when the dataset is sorted.- True

Still stressed from student homework?
Get quality assistance from academic writers!