I am getting these errors:
etoxfunction.cpp:10: parse error before `continue'
etoxfunction.cpp: In function `int main ()':
etoxfunction.cpp:24: parse error before `continue'
etoxfunction.cpp: At top level:
etoxfunction.cpp:81: parse error before `continue'
etoxfunction.cpp:84: syntax error before `<'
etoxfunction.cpp:85: syntax error before `<'
with this code:
what could be the problem?Code:#include <iostream> #include <cmath> #include <iomanip> void intro(); double getvalue(double& xvalue); double calculate(double DELTA, double factorial,int& expntofx, double nthterm, double& xvalue, double& sumofterms); void showresult(double DELTA, int expntofx, double xvalue, double sumofterms); char continue(char response); void continloop(char response, double xvalue, double DELTA, double factorial, int expntofx, double nthterm, double sumofterms); int main() { double const DELTA = 0.000001; double sumofterms = 1; double nthterm = 1; double xvalue; int expntofx = 1; double factorial = 1; char response; intro(); response = continue(); continloop(response, xvalue, DELTA, factorial,expntofx, nthterm, sumofterms); cout<< endl; return 0; } void intro() { cout<< endl << endl; cout<< " x\n " << " APPROXIMATION OF e BY THE METHOD OF TAYLOR'S EXPANSION\n" << endl << endl; cout<< " This program will calculate the value\n\n" << " x\n" << " of e using the Taylor Series Expansion Method\n" << endl; } double getvalue(double& xvalue) { cout<< " x\n" << " Please enter the value of x in e and press enter: "; cin>> xvalue; cout<< endl << endl; return xvalue; } double calculate(double DELTA, double factorial,int& expntofx, double nthterm, double& xvalue, double& sumofterms) { while(abs(nthterm) > DELTA) { factorial *= expntofx; nthterm = (pow(xvalue, expntofx))/(factorial); sumofterms += nthterm; expntofx++; } return sumofterms; } void showresult(double DELTA, int expntofx, double xvalue, double sumofterms) { cout<< " With a precision of " << DELTA << "," << " and with " << ++expntofx << " terms\n\n" << "x\n"; cout<< " The value of e, where x = " << xvalue << " is: "; cout<< setiosflags(ios::fixed) << setprecision(7); cout<< sumofterms\n; cout<< endl << endl << endl; } void continue(char response) { char response; cout<< " Do you wish to continue?(Y/N)\n"; cin<< response; return response; } void continloop(char response, double xvalue, double DELTA, double factorial, int expntofx, double nthterm, double sumofterms) { while((response == 'Y') || (response == 'y')) { getvalue(xvalue); calculate(DELTA, factorial, expntofx, nthterm, xvalue, sumofterms); showresult(DELTA, expntofx, xvalue, sumofterms); } }
[code][/code]tagged by Salem



LinkBack URL
About LinkBacks



Have a nice day.