/* Filename: roots2.cpp Author: Br. David Carlson Br. Isidore Minerd Date: January 4, 2000 Modified: June 26, 2000; August 19, 2001; July 16, 2009 This program prints a table of square roots for the numbers 1, 2, 3, ... 100, pausing after every 20 lines until the user presses ENTER. Tested with: Microsoft Visual Studio 2005 Microsoft Visual Studio 2008 g++ under Linux */ #include #include // Needed for setw, setprecision, and setiosflags. #include // Needed in order to use sqrt function. using namespace std; const int Max = 100; const int Pause = 20; int main(void) { int k; cout << "Number: Square root:" << endl; for (k = 1; k <= Max; k++) { cout << setw(10) << k << setiosflags(ios::showpoint) << setw(10) << setprecision(5) << sqrt(static_cast(k)) << endl; if ((k % Pause == 0) && (k != Max)) { cout << "Press ENTER to continue"; cin.get(); cout << "Number: Square root:" << endl; } } return 0; }