Here is the code I have down so far:
#include <iostream>
#include <string>
int main()
{
int num;
cout<<"Enter number of plots: "<<'\n';
cin>>num;
double x[num], y[num];
double tf, t;
int nr, v0, x0;
cout<<"Enter value of initial speed: "<<'\n';
cin>>v0;
cout<<"Enter value of initial position: "<<'\n';
cin>>x0;
cout<<"Enter value of final time: "<<'\n';
cin>>tf;
nr =0;
t = 0;
while ((nr <= num) && (t <= tf))
{
y[nr] = (1/2 * 9.81 * t * t) + (v0 * t) + x0;
x[nr] = t;
nr++;
t++;
}
gnuplot_one_function ("Position vs Time","linespoints", "t", "x(t)", x, y, num);
}
[From comments]
...the graph is not true to its (expected) representation, as in, if I enter say an initial position of 10 - the graph starts at 0 still. Likewise for other variables like the number of points to plot is not represented correctly.