Here's the source code:
#include <>
using namespace std;
// This program is a demonstration of the physics formula relating distance traveled
// acceleration
// and time traveled. Users will input variables and be able to find out the distance traveled, given
// the time traveled, and acceleration.
// Global variables assigned for ease of use in the two functions
float t; // time elapsed
float v0; // starting velocity
float a; // Acceleration (generally 9.8, earth's gravity)
float calculations(float t, float v0, float a);
int main()
{
cout << "Please enter the time elapsed.\n"; cin >> t;
cout << "Please enter the starting velocity.\n"; cin >> v0;
cout << "Please enter the acceleration.\n"; cin >> a;
cout<< "The distance is " << first =" v0" t =" t*t;" second =" a">
As the last few comments note, I will be adding to this sometime soon. (I hope). It could be fairly useful in the future for my Physics courses (I won't be taking any real courses for at least until next year. I just enjoy reading my self-teaching physics book from time to time).
However, I am proud of myself for this one.
Also, on a side note, I added a slight bit of CSS to my myspace page. It just changed the color of the text of a header I added, but it's a step in the right direction!
No comments:
Post a Comment