C++ examples for File Stream:cin
Calculate Fahrenheit temperature and output
#include <iostream> using namespace std; int main()// w w w. ja va 2 s .c o m { double ctemp; // Celsius temperature double ftemp; // Fahrenheit temperature // Get value of ctemp (Celsius temp). cout << "Input a Celsius temp and press ENTER: "; cin >> ctemp; // Calculate ftemp (Fahrenheit temp) and output. ftemp = (ctemp * 1.8) + 32; cout << "Fahrenheit temp is: " << ftemp << endl; return 0; }