-
Can I make a plot?
Let's say I've got the following function. It outputs an array that represents a sine wave for two periods. Is there a way I can ouput it to my screen so that it makes graph? I've used GNUplot but I was wondering if there was a way I could do it dirrectly in C++. Could this also be done in C?
Code:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double y[200];
int i;
for (i=0; i<200; i++)
y[i]=sin(2*M_PI*(i)/100);
for (i=0; i<200; i++)
cout<< y[i]<<endl;
return 0;
}
-
There are no C or C++ standard functions that will do that. You have to use operating-specific functions or a cross-platform library such as wxWindows, QT, or the GNU drawing package you already use.