What are the outputs c A cout

What are the outputs( c++)?

A.) cout << abs(-25 / 2) + time(NULL) << \"\ \";

       cout.precision(10);

B.) cout << fabs(-25 / 2.0) + time(NULL) << \"\ \";

Solution

NOTE: OUTPUT varies with the current time

Solution1.cpp

#include <iostream>
using namespace std;
int main()
{
cout << abs(-25 / 2) + time(NULL) << \"\ \";//time(NULL) function returns no of seconds since January 1, 1970)

//abs() function displays absolute a value (-25/2)=12

       cout.precision(10);//Sets the decimal precision to be used to format floating-point values on output operations.
}


output

1476330976

Solution2.cpp

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << fabs(-25 / 2.0) + time(NULL) << \"\ \";//fabs() functiondisplay float absolute value (-25/2.0)=12.5
////time(NULL) function returns no of seconds since January 1, 1970)

}


output

1.47633e+09

What are the outputs( c++)? A.) cout << abs(-25 / 2) + time(NULL) << \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site