Evel Kneievel

I need help quickly starting this function. I'm on limited time so if anyone can help me quickly that would be Great!



https://mail.google.com/mail/u/1/?ui=2&ik=bf2b82cafb&view=att&th=163225431ee5cd1f&attid=0.1&disp=safe&realattid=1632253b85af6830dd51&zw
Hello Mattrat,

I tried your link, but it does not work for me.

Andy

Maybe try it again. It worked fine for me.

This is what I have so far, for this program.

//Matthew Final Program
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
const double g=32.2;//acceleration due to gravity
const double k=0.158;//air drag constan
void inputValues(double& v, double& A);
double xcalc(double v, double A);
double ycalc(double v, double A);
double tcalc(double v, double A);

int main(){

cout<<"Take off angle:"
cout<<"Take off speed:"
cout<<"\n";
cout<<"time(s)"<<"x-distance(ft)"<<"y-distance(ft)"<<endl;
cout<<tcalc(v,A)<<" "<<xcalc(v,A)<<" "<<ycalc;
return 0;




}

void inputValues(double& v, double& A){
cout<<"Matthew Cibulka\n";
cout<<"Please enter the take off speed in mph:\n";
cin>>v;
cout<<"Please enter the take off angle in degrees:\n";
cin>>A;
return;
}

double xcalc(double v, double A){
double x=0;
double t=0;
while(
x=((v*cos(A)/(k))*(1-exp(-k*t)));
return x;
}

double ycalc(double v, double A){
double y=0;

double t=0;

y=((-g*t)/(k)+(1/k)*(v*sin(A)+(g/k))*(1-exp(-k*t)));
return y;
}

double tcalc(double v, double A){
double t=0;

t=t+0.5;
return t;
}
Last edited on
You don't know the difference between degrees and radians. cos() and sin() require the angle in radians, but your input is asking for one in degrees.

t (time) is an independent variable, not a function of v and A. At a rough guess you would be outputting a table of values at equal increments in time.

Your formulae for x and y appear to be correct for a linear drag force, but they are heavily overbracketed and difficult to read. x should obviously NOT be set within a while loop. It's just evaluated once at that particular value of t.

You will need to pass time t as argument to both xcalc and ycalc.

You have plenty of prompts, but no input statements in main. You need to actually call inputValues() there. After that, I expect that you will need a loop over times, but I don't know what your assignment asks.

I have no intention of looking at the external mail link you provide and I suspect most other forum users would think twice, given the URL.

Please PUT YOUR CODE IN CODE TAGS.

Last edited on
I have already submitted it so what grade do you believe I will get?
closed account (E0p9LyTq)
Maybe try it again. It worked fine for me.

That is your personal GMail account you are linking to. Of course it works for you and no one else.
When I try to compile your code I get four compilation errors. I've been out of school for a long time but when I was there, several profs would give zero points for a program that didn't compile :(.

Topic archived. No new replies allowed.