采用逐段比较法直线插补曲线 y=5*x2+16*x-5, x∈[-5,5]

来源:百度知道 编辑:UC知道 时间:2024/06/23 18:25:27
麻烦把程序编出来 谢谢

#include <math.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <graphics.h>

#define SIZE 3000

float fun(float x);
float xchange(float x);
float ychange(float y);
void drawline(int color);
void drawchaline(int n, int color);
int chazhi(int *n, float deta);

const int left = 50;
const int right = 550;
const int top = 50;
const int bottom = 400;

float x[SIZE];
float x1[SIZE];

float fun(float x)
{
return 5*x*x+16*-5;
}

int main()
{
int GraphDriver;
int GraphMode;
int i;
int n = 2;
float deta = 0.0001;
char buffer[10] = {'\0'};
char szfilename[255]= {"c: \\text1.txt"};
int ok;
FILE *fp;
GraphDriver = DETECT;
initgraph(&GraphDriver, &GraphMode, "");

x[0] = -5;
x[1] = 5;
setco