Hey,
First off, I want to thank everyone for helping me so much. (I've discovered that programming really isn't my thing-- and you guys have really been helping me through it by helping me to fix and learn from my mistakes.)
Alright, but now on to my next problem. I'm working on a program that'll estimate the area under a curve given a specific equation. I'm working out the logic, having a difficult time, but am overall getting by little by little.
Now, we're working on learning functions. And for some reason, with or without the functions included in my program, I'm getting an error every time I try to compile:
"parse error before numeric constant"
I'm using DevC++ and am getting it on line 29.... The double a line is being highlighted (yes, I'm aware that the problem lies on the line before the double a)
I also want to quickly note that THIS IS NOT THE FULL PROGRAM. I HAVEN'T COMPLETELY FILLED IN ALL OF THE LOGIC YET
but here it is:
Code:#include <stdio.h> #define a 0.0 #define b 1.0 double x(), f(), trapezoidal(); int main(void) { double a; double b; double x; double fx; double accuracy; int n; printf("TRAPEZOIDAL PROGRAM\n\nThis program calculates the area of a given function:\nf(x) = 2x^2 + 3x + 1\nIn the interval [0,1].\n\n"); return 0; } double x(int n, double x) { x = (1/n); return x; } double f(double x, double fx) { fx = 2 * x * x + (3 * x) + 1; return fx; } double trapezoidal(double a, double b, int n) { return trapezoidal; }
I've been working on ths program forever, and am having a considerable amount of difficulty with it. Does anyone know what I might be doing wrong?
Like I said, I'm aware of the incomplete functions and everything...
Any ideas?