menu

arrow_back Is the problem solved correctly?

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

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:
5f9ec0849c2bc655308628.png

2 Answers

by
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?
by
0 votes
t = fabs(x) + (1 / (pow(y, 2) + 1));

4 Comments

Ruslan Tilyaev , wrong, the correct code gives the answer 4.25...
https://ideone.com/EjhfA5
5f9fb82488755798621510.png
Ruslan Tilyaev there is something wrong with your assignment
5f9f08c2b0114093039891.jpeg
the result is the same