I am supposed to calculate Euler's number in a separate file to a given tolerance and return it using only global variables. After in cin a tolerance, it basically crashes. Do i have an infinite loop, or am i not sending any variables back?
#include<iomanip>
#include<iostream>
#include<cmath>
#include<string>
usingnamespace std;
void find_e();
double tol = 0;
externdouble e;
externdouble diff;
externdouble newe;
string ans = "yes";
int main()
{
while(ans == "yes")
{
cout<<"This program will estimate the value of Euler's number to your desired tolerance"<<endl<<endl;
cin>>tol;
system("cls");
if(tol > 0.0)
{
find_e();
cout<<"The new value of e is "<<endl;
cout<<"The actual value of e is "<<endl;
cout<<"The difference is "<<endl;
}
else
{
cout<<"You can't have a negative tolerance"<<endl<<endl;
}
}
system("pause");
return 0;
}
..and here is my separate file with the function to calculate "e".