Write a modular C++ program to generate user-specified subsequence fragments demonstrating linear, polynomial, and exponential rates of growth, as specified below.
  Please specify the type of sequence you wish to examine.
          a  ---  Arithmetic (linear)
          p  ---  Polynomial (specify degree)
          g  ---  Geometric  (exponential)
  Enter 'q' to quit or 'h' to display this menu again.
  apgqh>
  
  After generating and displaying a sequence fragment and its sum,
  the program displays the simple prompt apgqh>. 
  Iterations continue in this fashion until the user quits.
  
            double x;  int i;
            bool isInteger = false;
            cin >> x;
            if ( abs(x) < INT_MAX ){
               i = static_cast<int>(x);
               isInteger =  (x == i);   // ...same as ( x == double(i) ).
            } 
The constant INT_MAX is the largest integer representable
on the given machine and is available from the standard library 
<climits>.
  Please specify the type of sequence you wish to examine.
          a  ---  Arithmetic (linear)
          p  ---  Polynomial (specify degree)
          g  ---  Geometric  (exponential)
  Enter 'q' to quit or 'h' to display this menu again.
  apgqh>  a
  Arithmetic sequence { a0 + i*d } for i = 0,1,2, ..., L-1.
  Enter the first element a0:                           3
  Enter the difference d between successive elements:   5
  Enter the fragment length L:                          7    
  Fragment:
  3,  8,  13,  18,  23,  28,  33
  Fragment Sum: 126
  apgqh>  a
  Arithmetic sequence { a0 + i*d } for i = 0,1,2, ..., L-1.
  Enter the first element a0:                         2000000000  
  Enter the difference d between successive elements: 100000000  
  Enter the fragment length L:                        4          
  Fragment:
  2000000000,  2100000000,  2.2e+09,  2.3e+09
  Fragment Sum:   8.6e+09
  apgqh>  a
  Arithmetic sequence { a0 + n*d } for i = 0,1,2, ..., L-1.
  Enter the first element a0:                         8
  Enter the difference d between successive elements: -6
  Enter the fragment length L:                        4
  Fragment:
  8,  2,  -4,  -10 
  Fragment Sum:  -4
  apgqh>  p
  Polynomial sequence { c*(x0+i*d)^n } for i = 0,1,2, ..., L-1.
  Enter the degree n:                       2
  Enter the constant multiplier c:          1
  Enter the initial value of the base x0:   3
  Enter the base increment d:               2
  Enter the fragment length L:              5
  Fragment:
  9,  25,  49,  81,  121
  Fragment Sum:  285
  apgqh>  g
  Geometric sequence { a0 * r^(i-1) }  for i = 1,2, ..., L.
  Enter the first element a0:                           3
  Enter the ratio r between successive elements:        5
  Enter the fragment length L:                          7    
  Fragment:
  3,  15,  75,  375,  1875,  9375,  46875
  Fragment Sum:  58593
  apgqh>  g
  Geometric sequence { a0 * r^(i-1) }  for i = 1,2, ..., L.
  Enter the first element a0:                           3
  Enter the ratio r between successive elements:        0.5
  Enter the fragment length L:                          7    
  Fragment:
  3,  1.5,  0.75,  0.375,  0.1875,  0.09375,  0.046875
  Fragment Sum:  5.95312
  apgqh>  q