Combining the conversion and output for calculation - C++ File Stream

C++ examples for File Stream:cout

Description

Combining the conversion and output for calculation

Demo Code

#include <iostream>
using namespace std;
int main()//from  ww  w  .ja v  a 2s.c o  m
{
   double  ctemp;   // Celsius temperature
   // Prompt and input value of ctemp.
   cout << "Input a Celsius temp and press ENTER: ";
   cin >> ctemp;
   // Convert ctemp and output results.
   cout << "Fahr. temp is: " << (ctemp * 1.8) + 32;
   cout << endl;
   return 0;
}

Result


Related Tutorials