Temperature Table Display

Published on: August 4, 2010

C++ Console applications can be used for more than just completing equations or output/input scenarios. In this tutorial, I show you that you can actually use C++ Console apps to show data in tables. In this case, I show you the temperature table of Celsius, Fahrenheit, and Kelvin. This is one kind of scenario where the programmer has all the control when it comes to what is to be displayed on the screen. There are no inputs, just outputs of temperature in an aligned fashion.

I realize my birds in the background can be loud and I apologize for that. But if you want a copy of the actual code of the program itself, please let me know, I'll send it to you as soon as I can.

Remember to checkout the Codesnip below to review the C++ code yourself! Feel free to copy the code, but I ask that you please provide credit if you leave the code unchanged when you use it.


//Programmer: Nazmus
//Program:  Temperature Table Display
//Website:  EasyProgramming.net


using namespace std;

void main()
 float celsius, fahrenheit, kelvin;

 cout << setw(15) << "Celsius" << setw(18) << "Fahrenheit" << setw(15)<< "Kelvin" <<endl;

  fahrenheit = (9/5.) * celsius + 32;
  kelvin = celsius + 273.;

 cout << setw(15) << celsius << setw(18) << fahrenheit << setw(15)<< kelvin << endl;