Demonstrates cin, newline - C++ Language Basics

C++ examples for Language Basics:Console

Description

Demonstrates cin, newline

Demo Code

#include <iostream>
using namespace std;
int main()/* w  ww  . j a v a 2 s.c  om*/
{
   int ftemp;  //for temperature in fahrenheit
   cout << "Enter temperature in fahrenheit: ";
   cin >> ftemp;
   int ctemp = (ftemp-32) * 5 / 9;
   cout << "Equivalent in Celsius is: " << ctemp << '\n';
   cout << "this is a test\n";
   return 0;
}

Result


Related Tutorials