COMO HACER GRAFICAS EN C++?
Aqui un ejemplo:
#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <math.h> int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int x; float pi=3.1416; float grados,y; grados=(2*pi)/360;/* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ""); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* terminate with an error code */ } for(x=0;x<360;x++){ y=sin(x*grados); y=y*100; putpixel(x+100,y+100,5); } /* clean up */ getch(); closegraph(); return 0; }
Mas ejemplos:
Comentarios
Publicar un comentario