Skip to content

Instantly share code, notes, and snippets.

@KirinDave
Created November 14, 2008 04:06
Show Gist options
  • Select an option

  • Save KirinDave/24777 to your computer and use it in GitHub Desktop.

Select an option

Save KirinDave/24777 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <iomanip>
const int LOWER = 0;
const int UPPER = 300;
const int STEP = 20;
double f_to_c(double f){
return (f - 32) * (5.0 / 9.0);
}
int main (int argc, char * const argv[]) {
std::cout << std::setw(4) << "F" << "|" << std::setw(4) << "C" << std::endl;
std::cout << "---------" << std::endl;
for (int ctr = LOWER; ctr <= UPPER; ctr += STEP) {
std::cout << std::setw(4) << ctr << "|" << std::setw(4) << f_to_c(ctr) << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment