#### Category : equation I have the answer to this equation in Pascal. Can anyone help me convert this to c or c ++? Source: Windows Que..

Read more

I have a C++ lab and the problem is this: The user should enter a value for X(X is the number of tests held). If x<15, the program does not calculate anything. If X is between 16 and 30, the program should calculate C=1.0/10.0*(24A) and if X>30 the program should calculate C=0.15(24*A). My multiple if ..

Read more

Y=-4bb+5.0/9.0*(a/b)+10 Hello guys, this is an equation that I should program in C++. This is the form that I have entered: Y=-4*(b^2)+5.0/9.0*(a/b)+10; and for a=2 and b=3.4 I get the result -35.9132 while in my calculator the result is −35.259608. Can someone help me with finding the error cuz I am not sure what it ..

Read more

I need to evaluate the expression cbrt(b) / ((b)^2 + 1). If b less than zero, the log is not correct and outputs an incorrect answer. For example, if the input is -3 the answer is y = -1IND. #include <iostream> #include <cmath> int main() { float b, y, y1, y2; std::cout << "The equation: ..

Read more

C++ I need to evaluate the expression cbrt(b) / ((b)^2 + 1) if ‘b’ is only negative number log is not competent { y1 = cbrt(b); y2 = pow(b,2) + 1; y2 = 1 / y2; y = y1 * y2; cout << "y = "<< y << endl; } Source: Windows Que..

Read more

I am trying to write a piece of code for my old Highschool teacher for a game he had us play literally called the "Dice Game." Let’s just say that the game takes two d12’s and multiplies them together to get a number (D) in this instance. Then you take 3 d6’s and roll them ..

Read more

int Electra2D::Collision() { for (std::list<Entity>::iterator affecting = entities.begin(); affecting != entities.end(); ++affecting) { for (std::list<Entity>::iterator affected = entities.begin(); affected != entities.end(); ++affected) { if (affecting->type == DrawTypes::Circle && affected->type == DrawTypes::Circle && affecting->object->id != affected->object->id) { float distance = affected->pos.getDistance(affecting->pos); float limit = ((ObjectCircle*)affected->object)->radius + ((ObjectCircle*)affecting->object)->radius; if (distance <= limit) { Vector2 SP = affected->velocity ..

Read more

Can somebody explain me this task: Write a function whose call will print the solutions of the equation for a predefined range of variables. The function should have two parameters, the beginning and the end of the range, and the equation for which solutions are sought is: x ^ 2 + 2x – 5 Test ..

Read more

I am trying to make something like this: 2^1 + 2^2 + 2^3 + 2^4 + … + 2^n This is my code: #include <iostream> int main(){ int n, p=0; std::cout<<"N: "; std::cin>>n; for(int i=1; i<=n; i++){ p = p+(2^i); } std::cout<<p; return 0; } The result is always incorrect. If I input 4, the ..

Read more

Original problem. Given two valid fractions a/b and c/d. Each transformation is adding 1 to a and b, then optimizing a/b. Find the number of steps transforming a/b into c/d so that 0<a<b<100000 and 0<c<d<100000, or none if there is no ways. #include <iostream> #include <math.h> using namespace std; int gcd(int x, int y) { ..

Read more