I made some progress in writing out the beginning of this program. I think this is where I need to start working on using pointer language. If I understand you're first response, I need a second declaration of my variables, i.e. *a, *b etc, to pass them back and forth between main and other functions. I'm just testing right now to do a scan in a function then print it out in main.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void program_intro(void);
float input_read(float a, float b, float c, float x_initial, float x_final, float x_delta);
int main()
{
float a, b, c, x_initial, x_final, x_delta;
program_intro();
input_read(a, b, c, x_initial, x_final, x_delta);
printf("a = %2.f\n", a);
printf("b = %2.f\n", b);
printf("c = %2.f\n", c);
printf("x = %2.f\n", x_initial);
printf("x[i] = %2.f\n", x_final);
printf("delta X = %2.f\n", x_delta);
return 0;
}
void program_intro(void) //Explanation of program to the user
{
printf("This program will compute a range of values for\n");
printf("the second degree polynomial f(x) = ax^2 + bx + c,\n");
printf("the derivative f'(x) = 2ax + b, \n");
printf("the integral F(x[i]) = (a/3)x[i]^3 + (b/2)x[i]^2 + cx, and the\n");
printf("area A = F(x) - F(x[i]).\n\n");
return;
}
float input_read(float a, float b, float c, float x_initial, float x_final, float x_delta)
{
printf("Please input the polynomial coefficients as follows:\n\n");
printf("Coefficient a: ");
scanf("%f", &a);
printf("\nCoefficient b: ");
scanf("%f", &b);
printf("\nCoefficient c: ");
scanf("%f", &c);
printf("\n\nPlease input the range and increment to be tested as follows:\n\n");
printf("x: ");
scanf("%f", &x_initial);
printf("\nx[i]: ");
scanf("%f", &x_final);
printf("\ndelta x: ");
scanf("%f", &x_delta);
return a, b, c, x_initial, x_final, x_delta;
}