#Math Coding Issue

7 messages · Page 1 of 1 (latest)

brazen ice
#

I need to Calculate the values(the one with 0,9; 10, -0,76, -4) and the coding format should be like this(the last two images example of what i need to do) and result shouldn't have "infinite". But my codes unfinished(which it will have some errors) and couldn't figure out what should i fix or type

plush pastureBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

brazen ice
#

Heres the code example that teacher gave us(if anyone want to test)

#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char** argv)
{
double x, a, A, B, C, D, beta;
cout << "Input x=";
cin >> x;
cout << "Input a=";
cin >> a;
A = (x + cos(x)) / (x - sin(x));
cout << "A="<<A<<endl;
B = pow(pow(sin(x), 3) + 1, 2);
cout << "B=" << B << endl;
C = sqrt(exp(x - 1));
cout << "C=" << C<< endl;
D = sqrt((sin(x)*sin(x) + cos(x)) / sin(x));
cout << "D=" << D << endl;
beta = log(A)*log(A) - a / 3.0*sqrt(B - C) + D;
cout << "beta = " << beta << endl;
system("PAUSE");
return 0;
} ```
#

And heres mine

#include <cstdlib>
#include <math.h>
using namespace std;
int main() {
double x, a, y, A, B, C, D, result;
cout << "input x=";
cin >> x;
cout << "input a=";
cin >> a;
cout << "input y=";
cin >> y;
A = 3 * exp(a, 2) * exp(x, 4) + a * x * (2) + y / e (x + y) + e (x – y);
cout << "A= " << A << endl;
B = sqrt(abs(exp(x, 2) * sin(a * x) – exp(y, 4)* cos(a * x)) / 1 + exp(sin, 2) * (a * x) + exp(cos, 2) * (a * x);
cout << "B= " << B << endl;
C = exp(tan(x/2),3);
cout << "C= " << C << endl;
D = cos(x)*tan(y) / exp(e, a * x);
cout << "D = " << D << endl;
result
cout << "delta= " << delta << endl;
system("PAUSE");
return 0; 
} ```
brazen ice
#

Though i think i should posted way earlier but i need to take a sleep here(its 12 am for me), but i will reply back if answer/solution were given

brazen ice
# brazen ice And heres mine ``` #include <iostream> #include <cstdlib> #include <math.h> usi...

Changed some stuff from my previos code

#include <cstdlib>
#include <cmath>
using namespace std;

int main() {
    double x, a, y, A, B, C, D, result;

    cout << "input x=";
    cin >> x;
    cout << "input a=";
    cin >> a;
    cout << "input y=";
    cin >> y;

    A = 3 * exp(a) * exp(x) * exp(4) + a * x * 2 + y / (exp(x + y) + exp(x - y));
    cout << "A= " << A << endl;

    B = sqrt(abs(exp(x) * exp(2) * sin(a * x) - exp(y) * exp(4) * cos(a * x))
    cout << "B= " << B << endl;

    C = (1 + exp(sin(a * x)) * exp(sin(a * x)) + exp(cos(a * x)) * exp(cos(a * x)));
    cout << "C= " << C << endl;

    D = exp(tan(x / 2), 3) - cos(x) * tan(y) / (exp(1) * a * x);
    cout << "D = " << D << endl;

    result = log(A) + sqrt(B) - C + D;
    cout << "result= " << result << endl;

    system("PAUSE");
    return 0;
} ```
#

The only thing it solved was calculating number 10(which, it didn't had any inf result and so on)