### Problem with wrong outputs

Hello I need help in fixing part b anc c. the problem with part b is that the out put is the higher integer versus what the actual input was. for example i put in integer 1 and 5 but get 5 and 5 is: 3..

The problem I have with part c is that it is not doing the exponents instead it does something else not sure what i did wrong since i did follow some online guides for doing exponents.

DIRECTIONS FOR PART B:
 1234567 (b) Next, you will prompt the user for a pair of integers and output the length of the interval between the numbers. Example: if the input is \5 5" the length is 0, if the input is \1 9" the length is 7.  This time you will use a while loop to determine the interval.  There are no incorrect values here, any two integers will do.  When the computation is done, output the length like The interval between 1 and 5 is: 3

 12345678910111213141516171819202122232425262728  //// PART B: { cout << "Please input two integers: " << endl; int integer1; int integer2; cin >> integer1; cin >>integer2; int interval(int integer1, int integer2); int counter = 0; if(integer2 < integer1) std::swap(integer1, integer2); while (++integer1 < integer2) { ++counter; } int intervalAmount = counter; cout << "The interval between " << integer1 << " and " << integer2 << " is: " << intervalAmount << endl ; } 

DIRECTIONS FOR PART C
 1234567891011 Last you will compute the product n^i. Prompt the user for two integers and make the computation.  Now you will use a do-while loop.  The rst value input, n can be any integer. The second value, i, must be non-negative. If the i input is negative, you will continue to prompt the user for a new pair of values, n and i, where the i is non-negative. Note: If the input values are large, the result will \over ow" and what is printed out will really be garbage. That is the way things happen sometimes.  When the computation is done, output the product like The product of 3 ^ 4 is: 81 

 1234567891011121314151617181920212223242526272829303132  /// PART C: { #include int base; int exponent; int pow (int base, int exponent); int result = 1, i = 0; do { cout << "Please input two integers, the second must be non-negative: " ; cin >> base; cin >> exponent; result *= base; ++exponent; cout << "The product of " << base << " ^ " << exponent << " is " << result << endl; } while (i++ < exponent); return 0; }