RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 2768 | Replies: 6 | Thread Tools  Display Modes
Reply
Join Date: Sep 2005
Posts: 4
Reputation: Loaded Scissors is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Loaded Scissors Loaded Scissors is offline Offline
Newbie Poster

Creating Graphs

  #1  
Sep 13th, 2005
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Location: Oklahoma
Posts: 902
Reputation: chrisbliss18 is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 23
chrisbliss18's Avatar
chrisbliss18 chrisbliss18 is offline Offline
Posting Shark

Re: Creating Graphs

  #2  
Sep 13th, 2005
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
Reply With Quote  
Join Date: Jun 2005
Posts: 33
Reputation: shre86 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
shre86 shre86 is offline Offline
Light Poster

Re: Creating Graphs

  #3  
Sep 13th, 2005
Have u got all the points on the projectile?? If so then simply incude graphics.h in your program and then read through a bit of the help.. Plotting of the points will be easy.. So i dont think u ll have trouble doing.. If u have any trouble get back to the forum..
Reply With Quote  
Join Date: Sep 2005
Posts: 4
Reputation: Loaded Scissors is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Loaded Scissors Loaded Scissors is offline Offline
Newbie Poster

Re: Creating Graphs

  #4  
Sep 13th, 2005
Hiya I've added the include <graphics.h> but am unaware which "help" you are refering to ?
Reply With Quote  
Join Date: Sep 2005
Posts: 4
Reputation: Loaded Scissors is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Loaded Scissors Loaded Scissors is offline Offline
Newbie Poster

Re: Creating Graphs

  #5  
Sep 13th, 2005
and just to add to the above it doesn't seem to recognise graphics.h
Reply With Quote  
Join Date: Jul 2005
Posts: 244
Reputation: Drowzee is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
Drowzee Drowzee is offline Offline
Posting Whiz in Training

Re: Creating Graphs

  #6  
Sep 13th, 2005
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.
Reply With Quote  
Join Date: Sep 2005
Posts: 4
Reputation: Loaded Scissors is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Loaded Scissors Loaded Scissors is offline Offline
Newbie Poster

Re: Creating Graphs

  #7  
Sep 13th, 2005
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 :

#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;
}
<< 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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C++ Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:38 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC