Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,491 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,304 people online right now. Registration is fast and FREE... Join Now!




find acceleration + takeoff time of jet program

 
Reply to this topicStart new topic

find acceleration + takeoff time of jet program, given velocity and distance

INFIA
1 Mar, 2007 - 08:04 PM
Post #1

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 20


My Contributions
I am sure i have the mathamatics correct on this, but im unsure of the programming aspect of it..... this is wat i have and wont compile....

#include <iostream.h>
#include <stdlib.h>
using namespace std.;
//define floats

int main()
{
float distance;
float speed;
float time;
float acceleration;

cout < < " Enter jets takeoff speed in Km/hr.: /n";
cin > > speed;
cout < < "Enter distance of takeoff in meters.: /n";
cin > > meters;

time = (7.2*(distance)/ speed)
acceleration = (speed /(distance * 3.6)

cout < < "The acceleration of a jet";
cout < < "traveling at " < < speed < <"Km/Hr" endl;
cout < < "at a distance of " < < distance < < "meters." endl;
cout < < "Is " < < acceleration < < " meters/seconds^2" endl;
cout < < ", with a time of " < < time < < " seconds to reach takeoff speed" endl;

system("PAUSE");
return 0;
}

if u spot any errors plz tell me, bc i m lost in code! thank you!
User is offlineProfile CardPM
+Quote Post

Xing
RE: Find Acceleration + Takeoff Time Of Jet Program
1 Mar, 2007 - 08:30 PM
Post #2

D.I.C Addict
Group Icon

Joined: 22 Jul, 2006
Posts: 723



Thanked: 4 times
Dream Kudos: 1575
My Contributions
See the changes

CODE
#include <iostream>
#include <cstdlib>
using namespace std;
//define floats

int main()
{
    float distance;
    float speed;
    float time;
    float acceleration;
    float meters;

    cout << " Enter jets takeoff speed in Km/hr.: \n";
    cin >> speed;
    cout << "Enter distance of takeoff in meters.: \n";
    cin >> meters;

    time = (7.2*(distance)/ speed);
    acceleration = (speed /(distance * 3.6));

    cout << "The acceleration of a jet";
    cout << "traveling at " << speed <<"Km/Hr"<<endl;
    cout << "at a distance of " << distance << "meters."<<endl;
    cout << "Is " << acceleration << " meters/seconds^2"<<endl;
    cout << ", with a time of " << time <<  " seconds to reach takeoff speed"<< endl;

    system("PAUSE");
    return 0;
}


User is offlineProfile CardPM
+Quote Post

INFIA
RE: Find Acceleration + Takeoff Time Of Jet Program
1 Mar, 2007 - 08:40 PM
Post #3

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 20


My Contributions
yes i see the changes, although the acceleration comes out infinatly. i dont understand the meaning of this, plz help!
User is offlineProfile CardPM
+Quote Post

INFIA
RE: Find Acceleration + Takeoff Time Of Jet Program
1 Mar, 2007 - 09:54 PM
Post #4

New D.I.C Head
*

Joined: 8 Feb, 2007
Posts: 20


My Contributions
I fixed it , thank you though, thanks alot guys.

heres the final product

#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
float distance;
float speed;
float time;
float acceleration;// define all floats

cout << " Enter jets takeoff speed in Km/hr.: \n";// first input
cin >> speed;
cout << "Enter distance of takeoff in meters.: \n";// second input
cin >> distance;
// prep for equations
time = (7.2*(distance)/ speed);
acceleration = (speed /(distance * 3.6));
// setup for output
cout << "The acceleration of a jet ";
cout << "traveling at " << speed <<"Km/Hr"<<endl;
cout << "at a distance of " << distance << "meters."<<endl;
cout << "Is " << acceleration << " meters/seconds^2"<<endl;
cout << ", with a time of " << time << " seconds to reach takeoff speed"<< endl;
// output and conclusion
system("PAUSE");
return 0;
}
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 05:28PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month