C++ examples for File Stream:cout
Use the formula
celsius = 5.0 / 9.0 * ( fahrenheit - 32 );
#include <iomanip> #include <iostream> int main(int argc, const char *argv[]) { std::cout << std::right << std::setw(12) << "Fahrenheit" << std::setw(12) << "Celsuis" << std::endl; for (int i = 0; i <= 212; ++i) { std::cout << std::right << std::setw(12) << i << std::right << std::setw(12) << std::setprecision(3) << std::showpos << std::fixed << ((5.0 / 9.0) * (i - 32)) << std::endl; }/*from w w w.j ava2 s .c om*/ return 0; }