/* A new feature in this program is the field width specifier setw(). setw(n) sets the field width to size n and right justifies the content of the field. This affects the next operation only. setw() requires . */ #include #include using namespace std; int main() { int n = 1, Tn = 1; cout << " Triangular Numbers\n"; cout << " ------------------\n"; while ( Tn < 99 ) { cout << " n = " << setw(2) << n; cout << " T(n) = " << setw(2) << Tn << endl; Tn += ++n; } cout << "\n\n"; system( "PAUSE" ); return( 0 ); }