arrow_back Is the problem solved correctly?

1 vote
Good day!
I'm just starting to work on c++.
There is a task:

You need to write a console application to get the answer c .
I wrote a function, the answer comes out completely different. Not the one specified in the task. I can't understand whether I made a mistake somewhere, or there is a mistake in the task!
#define _USE_MATH_DEFINES //математические константы
#include <iostream>
#include <math.h>

using namespace std;

int main() {
setlocale(LC_ALL, "rus");
double x, y, z, f, s, t;
x = 3.251;
y = 0.325;
z = 0.466*pow(10, -4);

/* Поэтапоное решение */
f = pow(2, pow(y, x)) + pow(pow(3, x), y); //1
s = y * (atan(z) - M_PI / 6); //2
t = abs(x) + (1 / pow(y, 2) + 1); //3

cout << "Результат c = " << f - s / t;

return 0;

My answer:

2 Answers

1 vote
It looks more like you just copied the code, because your calculations of f and t are not done correctly. And the values of x, y and z you put the wrong ones.

1 comment

Yes, I apologize. Apparently I screwed up and put the wrong values. I corrected it now. By the way, the answer became a bit approximate. And where exactly the calculation of f and t are not done correctly?
0 votes
t = fabs(x) + (1 / (pow(y, 2) + 1));


Ruslan Tilyaev , wrong, the correct code gives the answer 4.25...
Ruslan Tilyaev there is something wrong with your assignment
the result is the same