#include "stdio.h"
#include "stdlib.h"
#include "math.h"
#include "graphics.h"
#define fnx(x) (x0+x*s1)
#define fny(y) (y0-y*s1)
#define f(x) 0.2*(x)*(x)
void setup(void);
int x0,y0,maxx,maxy;
float s1;
main()
{
int xs,ys;
float x,y,x1,y1,x2,y2,dx,i;
setup();
x1=0;x2=5;dx=0.00001;
clearviewport();
setcolor(14);
xs=fnx(x1);ys=fny(0);
xs=fnx(x2);
xs=fnx(0);ys=0;
ys=fny(0);
x=x1;y=f(x);xs=fnx(x);ys=fny(y);
for(i=x1;i<x2;i+=dx)
{ putpixel(xs,ys,4);
x+=dx;y=f(x);xs=fnx(x);ys=fny(y);}
getch();
restorecrtmode();
}
void setup(void)
{
int driver,mode;
driver=DETECT;
initgraph(&driver,&mode,"");
maxx=getmaxx();
maxy=getmaxy();
x0=150;y0=150;s1=10;
setviewport(0,0,maxx,maxy,1);
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |