Freddy wrote:
I have a program that generates numerical output (as most of the
programs), the program is written in C language, and currently I use
the "DOS interface to show the output when it is being generated.
is there a "short" and "non-complicated" code which plots the data
automatically instead of showing the numbers.
the plots don't have to be something very fancy...but instead of
on-line monitoring of the numbers, the output can plot them in "real
time" (as they are being generated)..
I am also trying to stay away from Visual C++ codes...just sticking
to C as much as possible...
This may give you some ideas.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double pi;
/* ------------------- */
void pause(void)
{
/* fool around with the timers here if needed */
} /* pause */
/* ------------------- */
void plot(int angle)
{
double sine;
int isin;
sine = sin(pi * angle / 180);
isin = 30 * sine + 35.5;
printf("%4d %*c\n", angle, isin, '*');
} /* plot */
/* ------------------- */
int main(int argc, char *argv[])
{
int angle;
pi = 4 * atan(1.0);
for (angle = 0; angle < 3600; angle += 10) {
plot(angle);
pause();
}
return 0;
} /* main */
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson