Skip to content

Instantly share code, notes, and snippets.

@swimmi
Created April 20, 2014 14:22
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 swimmi/11115348 to your computer and use it in GitHub Desktop.
Save swimmi/11115348 to your computer and use it in GitHub Desktop.
Calculate the difference between this temperature and the previous one
#include <fstream>
#include <iostream>
using namespace std;
//Calculate the difference between this temperature and the previous one.
int main()
{
//ifstream cin("a_simple_question_of_chemistry.txt");
double a,b;
cin>>a;
while(cin>>b)
{
if(b==999)
{
cout<<"End of Output"<<endl;
break;
}
printf("%.2f\n",b-a);
a=b;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment