Hi I have a problem with some code. Basically what the program is supposed to do is to take in a minimum exponent and a maximum exponent and a base. Then its is suppose to create a table displaying the base to the power of the minimum exponent to the max exponent.I have got the positive exponents to work but I cannot get the negative exponents to work. I cannot use the pow() function.

ex.(this is what it should look like)

input:

Base = 2

max exponent = 3

min exponent = -2

output:

.25

.5

1

2

4

8

----------------------

however mine outputs (with the same data of course)

.5

1

.5

1

.5

1

2

4

8

16

32

------------------------

I do not know why

Here is the code so far

```
#include "StdAfx.h"
#include <iostream>
#include <math.h>
using namespace std;
void ExpPow(double &res, int base, int count);
void negexp(double &res, int base, int count);
int main()
{
int base;
int expow;
int expomax;
int count;
double res = 1;
int count1;
cout << "Please enter a maxiumum exponent value" << endl;
cin >> expomax;
cout << "Please enter a minimum exponent value" << endl;
cin >> expow;
cout << "Please enter a base" << endl;
cin >> base;
if(cin.fail())
{
cout << "Error input" << endl;
}
for(count1 = expow; count1 <= expomax; count1++)
{if(count1 <= 0)
{
for(count = 1; count < abs(expow); count++)
{
negexp(res,base,count);
}
for(count = expow; count <= expomax; count++)
{
negexp(res,base,count);
cout << res << endl;
cout << " " << expow << endl;
count1 = count;
}
}
}
{
if(count1 >0)
{
for(count = 1; count < expow; count++)
{
ExpPow(res, base, count);
}
for(count = expow; count <= expomax; count++)
{
ExpPow(res, base, count);
cout << res << endl;
cout << " " << expow << endl;
}
}
}
return 0;
}
void ExpPow(double &res, int base, int count)
{
res = res * base;
}
void negexp(double &res, int base, int count)
{
res = 1/abs((res * base));
}
```

Any help is appreciated, thank you.

P.S. forget the 'cout << " " << expow << endl;'