// finds maximum number input // demonstrates "iterate and keep track" idiom // Mikhail Nesterenko // 1/27/2014 #include using std::cin; using std::cout; using std::endl; int main(){ cout << "Input number [0 to quit]: "; int n; cin >> n; int max = n; // traking variable while (n != 0 ) { cin >> n; if (n > max) max = n; } cout << "Maximum number: " << max << endl; }