Skip to content

Instantly share code, notes, and snippets.

@peerasak-u
Created December 1, 2013 18:33
Show Gist options
  • Select an option

  • Save peerasak-u/7738989 to your computer and use it in GitHub Desktop.

Select an option

Save peerasak-u/7738989 to your computer and use it in GitHub Desktop.
188110-midterm-2011-2 ข้อ 3
#include <iostream>
using namespace std;
int main()
{
int time = 0;
int temperature = 0;
int bucketHeight = 40; //(H) from picture
float velocity = 0;
float level = 0; //result
cout << "Enter time(t) and temperature(T): ";
//Input Time and Temperature
cin >> time >> temperature;
//find velocity(v) from T
velocity = 331.5 + 0.6 * temperature;
//find level(h)
level = bucketHeight - (time/2) * 0.001 * velocity;
cout << "Level(h) = " << level << " m." << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment