C++ examples for File Stream:cin
Prompts for a number and then prints the square.
#include <iostream> using namespace std; int main()/* w ww . java2s . com*/ { double x = 0.0; // Prompt and input value of x. cout << "Input a number and press ENTER: "; cin >> x; // Calculate and output the square. cout << "The square is: " << x * x << endl; return 0; }