Get premium membership and access questions with answers, video lessons as well as revision papers.

Using c++ language, create a function called recip() that takes one double reference parameter.Have the function change the value of that parameter into its reciprocal.Write...

      

Using c++ language, create a function called recip() that takes one double reference parameter.Have the function change the value of that parameter into its reciprocal.Write a program to demonstrate that it works

  

Answers


Davis
#include
using namespace std;
void recip(double &d);
int main()
{
double = 100.0;
cout "x is " x '\n';
return 0;
}
void recip(double &d)
{
d = 1/d;
}
Githiari answered the question on May 29, 2018 at 18:48


Next: Given the following class, show how to initialize a ten-element array so that x has the values 1 through 10. class samp { i x; public: samp(int n) {x...
Previous: Rework the strtype class below so it uses new and delete. #include #include #include using namespace std; class strtype { char *p; int len; public: strtype(char *ptr); ~strtype() }; strtype::strtype (char *ptr) { len =...

View More Computer Science Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions