采用逐段比较法直线插补曲线 y=1/4*x2,x∈[-5,5]
来源:百度知道 编辑:UC知道 时间:2024/09/28 09:55:34
麻烦把程序编辑出来行么~~~~
TurboC 逐段比较直线插补曲线
#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 x * x / 4;
}
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;