I gave up on functions before because I could never seem to get them to work so I figured its about time I learned. I'm making a calculator to solve all of the equations we are using in physics.
Really messed up.Code:#include <cstdlib> #include <iostream> using namespace std; float df(float appgrav=10, float time) { return ((.5*appgrav)*(time*time); } int main(int argc, char *argv[]) { float acceleration; float time; float velocity; float distance; float speed; float gravity=9.8; float appgrav=10; char begin; cout<<"What equation would you like to use? [d]istance fallen, [v]elocity,\n[h]horizontal distance, [a]verage velocity."; cin>>begin; if (begin=='d') cout<<"Enter time:"; cin>>time; df(appgrav,time); system("PAUSE"); return EXIT_SUCCESS; }