Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
Need help fast C++
This is solving motion of physics… and for the intal speed i cant use 0 and i need to be able to.. i need to know how i can use a NULL so it solves for infomation that is not there. i used 0 not think but i cant figure it out…..ty for ur time
#include <iostream>
#include <string>
using namespace std;
string physicsnow(double v,double t,double d,double a,double dv)
{
cout <<"\n\n\n";
cout <<"~~Thinking cause ur to lazy to~~" << "\n\n";
int null=0; // use 0 as a variable.
if(v==null) // speed
{
v=d/t;
}
if(t==null) // time
{
t=d/v;
}
if(d==null) //distance
{
d=t*v;
}
if(a==null) //acceleration
{
a=dv/t;
}
if(dv==null) //detlav
{
dv=a*t;
}
cout <<"The Avg speed is: "<< v <<"m/s"<< "\n\n";
cout <<"The Time is: " << t << "s" << "\n\n";
cout <<"The Distance is: " << d << "m" << "\n\n";
cout <<"The Acceleration is: "<< a << "m/s sqr" << "\n\n";
cout << "The Change in Speed is: " <<dv<< "m/s" << "\n\n";
}
int main(int argc, char *argv[])
{
cout << "\n" << endl;
cout << "Thank your For using Motion Physics Calculator By ::zer0pain::"<< "\n" << endl;
cout << "To report any bugs plz feel free to email me at zer0.crashoveride@gmail.com" <<"\n"<< endl;
double v, t, d, a, vi, vf, dv ;
cout << "Directions:" << "\n" ;
cout << "For any varibles that u are solving for you must put '0'" << "\n" << endl;
cout <<"Please input speed in meters/second:" ;
cin >> v;
cout <<"Please input distance in meters:" ;
cin >> d;
cout <<"Please input time in seconds:" ;
cin >> t;
cout <<"Please input accerlation in m/s sqr:" ;
cin >> a;
cout <<"Please input intal speed in m/s:" ;
cin >> vi;
cout <<"Please input final speed in m/s:" ;
cin >> vf;
dv=vf-vi;
physicsnow(v, t, d, a, dv);
system("PAUSE");
return EXIT_SUCCESS;
}
I know absolutely nothing about physics but… I tested your program and it worked fine for me. What was your output when you tried to use 0 as your initial speed? This is what I got when I used your program. Everything seems good.
Thank your For using Motion Physics Calculator By ::zer0pain::
To report any bugs plz feel free to email me at zer0.crashoveride@gmail.com
Directions:
For any varibles that u are solving for you must put '0'
Please input speed in meters/second:30
Please input distance in meters:500
Please input time in seconds:20
Please input accerlation in m/s sqr:12
Please input intal speed in m/s:0
Please input final speed in m/s:10
~~Thinking cause ur to lazy to~~
The Avg speed is: 30m/s
The Time is: 20s
The Distance is: 500m
The Acceleration is: 12m/s sqr
The Change in Speed is: 10m/s
Press any key to continue . . .