io/copy-is-os.cc - Illustration of implicit stream conversion to a boolean value. | Lecture 2 - slide 38 : 46 Program 1 |
#include <iostream> #include <string> using namespace std; int main(){ int i; while (cin >> i) // cin is converted to 'a boolean value' // via an implicit conversion operator cout << 2*i << " "; cout << "The End"; }