So I am taking a basics of C++ class and everything is going well...except for this one set of problems.
If you all could take a look and tell me what I am doing wrong in the code (not setting the problem up right?) that would be fantastic.
Problem 1:
X2= a(b+c)^2
My code to solve it:
X2=a*(pow(b+c, a));
On my calculator, I am getting 215.31 for this problem, yet my program seems to be coming up with 809.99. Any ideas as to why?
Problem 2:
X3= 5√abc (the fifth root of a*b*c)
My code to solve it:
X3=abc*1/5;
For this particular one, I have not done this kind of math in 5 years, but I was going off an example our teacher provided us. I am coming up with 4.93
Last one, Problem 3:
X4= √(b^2-4ac)/2a
My code:
X4=sqrt((pow(b,2)-4*a*c)/2*a);
I am getting 8.06 in my program, but 9.60 on my calculator
I am not sure if I am just setting these up wrong, or I am just terrible at math lol, but in any case, a nudge in the right direction would be much appreciated. I do not want the answers to these, I just want to know if I am doing something fundamentally wrong in my code so I can fix it myself.
Thank you!