I am only allowed to use int, unsigned int and float. Must be accurate to the 7th significant digit. Currently I overflow 'float top' at an x value greater than 13. Thank you for your time.
#include <iostream>
#include <iomanip>
using namespace std;
float sum=1,x, top=1,factoral=1;
int main(void)
{
cout << "f(x) = e^x, if x = ";
cin >> x;
for(int i=1; i<=34; i++)
{
factoral*=i;
top *= x;
sum += top/factoral;
}
cout << "Then f(" << x << ") = " << setprecision(7) << sum <<endl;;
return EXIT_SUCESS;
}