Skip to content

Instantly share code, notes, and snippets.

@ReneeVandervelde
Created April 26, 2011 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReneeVandervelde/941858 to your computer and use it in GitHub Desktop.
Save ReneeVandervelde/941858 to your computer and use it in GitHub Desktop.
Increase in horsepower Calculation based on 0-60 times
#include <stdlib.h>
#include<iostream>
using namespace std;
/**
* Estimates the increase in horsepower of a car based on weight and a change in 0 to 60 times.
*
* @author Jimmy Goodsell
*/
int main(){
double w,t,e, hptheo, hptheo2, hpreal, hpreal2, eff, t2;
cout << "Please insert car weight (in lbs), 0-60 time (seconds), and horsepower" << endl;
cin >> w >> t >> hpreal;
w*=0.45359237;
e = .5*w*26.8224*26.8224;
hptheo = (e/t)/745.699872;
eff = (hptheo/hpreal);
cout << "The efficiency is: " << eff<< endl << "Now enter the new 0-60 time (in seconds)" << endl;
cin >> t2;
hptheo2 = (e/t2)/745.699872;
hpreal2 = hptheo2/eff;
cout << "The new horsepower of the car is: " << hpreal2 << " horsepower, a gain of " << hpreal2-hpreal << " horsepower" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment