Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how to get this code to out give = After 70 accelerations. Final velocity: 7.72067 #include #include #include #include #include using namespace std; // PLACE

how to get this code to out give = After 70 accelerations. Final velocity: 7.72067

#include

#include

#include

#include

#include

using namespace std;

// PLACE YOUR CODE UP HERE! All you should need is chooseGear!

int

// while you are allowed to change whatever you want as you design the chooseGear function

// for the version of the file you submit CHANGE NOTHING BELOW THIS LINE

// the tests will all fail if even a letter is out-of-place below here.

// in fact, it might make sense to redownload the provided code and just copy the

// chooseGear function above.

double accelerate(double v, int g, int &c);

// YOU CANNOT CHANGE main() IN YOUR SUMBISSION

int main() {

int vc=0;

int time = 70;

double vel = 0;

for(int i=0; i < time; i++)

{

double tempVel = vel;

int gear = chooseGear(tempVel);

vel += accelerate(vel, gear, vc);

}

cout << "After " << vc << " accelerations. Final velocity: " << vel <

return 0;

}

// You are not supposed to know the formula for accelerate.

// ... gl trying to find it out

// YOU CANNOT CHANGE THIS FUNCTION IN YOUR SUMBISSION

double accelerate(double v, int g, int &c)

{

static int vc=0;

c=++vc;

if(g<1 || g>6)

{

cout << "No such gear!";

exit(1);

}

double i=v;

double n=54%3;

int x = 256;

int y = 256;

for(int i=0; i < g; i++)

{

x>>=i%true|1;

y>>=!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!true;

if(!(i^(299&1750))) {x+=x/2;}

if(!((i-1)*(i+1)-2*(i-1)+-4)) {x&=y;x<<=1;}

}

double j=true;

int s=(1<<2)+(1<<0);

int m=0x0F>>1;

int b=0x21;

double V=0;

for(int z=1; z < 7; z++)

{

double X=1;

for(int j=1; j < 7; j++)

{

if(j!=z)

{

X*=(g-j)/(z-j);

}

}

X*=(z==(199^0xC2)? -b/4.0 : z>(3^1)? !(z^(132&68))?-(s|=7+(m>>=1)):-s:s);

s^=m;

!s?V+=n+i*(4+(g>4?4-g:g-4)-v*x/64.0):V*=j+(m^g)*(i-j*v);

m>>=1;

V+=X;

}

return V/10;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

Explain three broad global HR challenges.

Answered: 1 week ago