Code for moving

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2008
Posts: 2
Reputation: samaitaben is an unknown quantity at this point 
Solved Threads: 0
samaitaben samaitaben is offline Offline
Newbie Poster

Code for moving

 
0
  #1
Jun 22nd, 2008
Can any one please assist with code for two objects coming from different direction. Subsequently, collide after intersection. The objects should be moving at 80km/h. And collision should happen shortly 30 minutes after take off
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,813
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Code for moving

 
0
  #2
Jun 22nd, 2008
Originally Posted by samaitaben View Post
Can any one please assist with code for two objects coming from different direction. Subsequently, collide after intersection. The objects should be moving at 80km/h. And collision should happen shortly 30 minutes after take off

That's a program with many parts. You need to provide much more information. Is this a console application or a GUI? What do the objects look like? What does 80 km/h mean in relation to the computer screen (i.e. what is the distance in kilometers of the computer screen width)? And many other details. You need to decide with much more specificity what you want, tell us what you know how to do already, and post at least an attempt at this.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: Code for moving

 
0
  #3
Jun 22nd, 2008
Originally Posted by samaitaben View Post
Can any one please assist with code for two objects coming from different direction. Subsequently, collide after intersection. The objects should be moving at 80km/h. And collision should happen shortly 30 minutes after take off
This sounds like a physics problem with elements of-

Newton's Law
Conservation of Momentum
(Possible) Conservation of Energy

-You will most definitely need Conservation of Momentum since during the collision, there's no telling how much energy is lost from heat due to air resistance/crumpling. The first two laws should be a good start.

Also, what is the angle of misdirection? I have a program that can solve these kinds of problems but its written in Java.
Last edited by Alex Edwards; Jun 22nd, 2008 at 2:28 pm.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,813
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Code for moving

 
0
  #4
Jun 22nd, 2008
Originally Posted by Alex Edwards View Post
This sounds like a physics problem with elements of-

Newton's Law
Conservation of Momentum
(Possible) Conservation of Energy

-You will most definitely need Conservation of Momentum since during the collision, there's no telling how much energy is lost from heat due to air resistance/crumpling. The first two laws should be a good start.

Also, what is the angle of misdirection? I have a program that can solve these kinds of problems but its written in Java.
It all depends on what the OP has in mind regarding the collision. He/she could be looking for a collision that follows all of the laws of physics to the letter or the collision could simply be to display "Kaboom!" in text when it happens. We have no way of knowing until the OP tells us.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 2
Reputation: samaitaben is an unknown quantity at this point 
Solved Threads: 0
samaitaben samaitaben is offline Offline
Newbie Poster

Re: Code for moving

 
0
  #5
Jun 23rd, 2008
A blue passenger train moves southwards at a speed of 80km/hr. Unfortunately as it enters a junction it collides with a brown goods train moving northwards. The collision happened 30 minutes after the goods train takes off. Use C++ to illustrate the above.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: Code for moving

 
0
  #6
Jun 24th, 2008
Originally Posted by samaitaben View Post
A blue passenger train moves southwards at a speed of 80km/hr. Unfortunately as it enters a junction it collides with a brown goods train moving northwards. The collision happened 30 minutes after the goods train takes off. Use C++ to illustrate the above.
You will most likely want to print the coordinates of both the train and the brown goods train every minute or second, and display their speed as well.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC