Please support our C++ advertiser: Programming Forums
![]() |
•
•
Join Date: Sep 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Hiya, I'm pretty new to C++ (using bloodshed dev).
I am trying to display the path of a projectile (tennis ball) on a graph. I can do all of the calculations and output to a text file at each point however I can't find anything on the internet to explain how to plot these points on a graph (preferably in a console window).
Thank you for your time.
-Rob
I am trying to display the path of a projectile (tennis ball) on a graph. I can do all of the calculations and output to a text file at each point however I can't find anything on the internet to explain how to plot these points on a graph (preferably in a console window).
Thank you for your time.
-Rob
I'm not too familiar with graphics in C++, but I can see that you need to clarify a bit more. Are you talking about generating a text graph, a image file, or displaying a window with an image in it?
Did we help you? Did we miss the point entirely? Update your thread and let us know.
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
Don't like the answers you are getting?
Did you try searching?
Clean up and optimize Windows 2000/XP
•
•
Join Date: Jul 2005
Posts: 244
Reputation:
Rep Power: 4
Solved Threads: 4
I think he means look at the .h file to see if it has any helpful descriptions.
It's highly probable that you don't have the graphics.h file, but try the #include <graphics> and see if that works.
What do you want to see? An ascii art graph? A bitmap image?
We don't know what you're looking for, so we can't really help you just yet.
It's highly probable that you don't have the graphics.h file, but try the #include <graphics> and see if that works.
What do you want to see? An ascii art graph? A bitmap image?
We don't know what you're looking for, so we can't really help you just yet.
•
•
Join Date: Sep 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
to be honest I don't mind, it should look like a curved line graph (a parabola) I am open to anyway to display it.
My program currently looks like this :
<< moderator edit: added [code][/code] tags >>
I need to firstly learn how to plot those points on a graph of some description to display to the user while the program is running ( I don't know how to do that).
Then I need to make it so the user inputs the variables I know how to do this using "cin >>" but would like to get one graph drawn first.
My program currently looks like this :
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
int main()
{
//Declare Variables
float x,y,vx,vy,t,g,ct;
//Define variable starting values
x=0; //Horizontal Displacement
y=100; //Vertical Displacement
vx=20; //Horiz Velocity
vy=0; //Vert Velocity
t=0; //Time
g=-10; //Vertical Accelleration (Gravity)
ct=0.1; //Time Intervals
ofstream data("C:/Theproj.txt");
while (y>0) {
data <<"\n("<<x <<"," << y << ")";
x = x + ( vx * ct );
y = y + ( vy * ct );
vy = vy + ( g * ct );
}
cout << "Finnished";
return 0;
}I need to firstly learn how to plot those points on a graph of some description to display to the user while the program is running ( I don't know how to do that).
Then I need to make it so the user inputs the variables I know how to do this using "cin >>" but would like to get one graph drawn first.
![]() |
Similar Threads
Other Threads in the C++ Forum
- Creating Graphs (Java)
Other Threads in the C++ Forum
- Previous Thread: Need some simple help!
- Next Thread: C++ Question...with uncompleted answer..anyone can solve it?
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode