I'm having some trouble with figuring out how to write a certain program. the program i am supposed to write is meant to read in values from a data file and use those methods to find the roots of a quartic equation (x^4+3*x^3......+4) using the method of halving the interval. I believe i have the right code to obtain values from a data file, but don't know how to proceed from there. Any help would be greatly appreciated.
This is what i have so far.
Code:
#include "stdafx.h"
int main()
{
double upperlimit, lowerlimit, b, c, d, e;
double high, root;
FILE *inp;
int file_open = fopen_s(&inp, "U:\\GENG1003\\data.dat", "r");
int file_read = fscanf_s(inp, "%lf %lf %lf %lf %lf %lf", &b, &c, &d, &e, &lowerlimit, &upperlimit);
if (file_read == 6)
{
printf("For quartic polynomial a=1; b=%lf; c=%lf; d=%lf; e=%lf \n", b, c, d, e);
printf("Within the domain of %lf < x < %lf \n", lowerlimit, upperlimit);
high = upperlimit;
}
else
printf("Invalid data \n");
return 0;
Thank you.