So i have been reading lazy foo's tuts and been playing around with SDL, i have created a little thing where if you click the dot should fly that way and be pulled down by gravity (it is really simple) the idea is kinda like angry birds very basic concept, however i keep getting werid results such as going really fast, shooting up and gravity breaking. So i was woundering is someone could have a look and help thanks i think its today with these parts,

It looks like you are approaching this like moving a point on a graph. At the moment, if a user clicks left of the dot, the dot would still move right, and the y would now go the opposite direction you intend because of change of sign in deltaX. It also seems to me that your gravity is substantially smaller than your shooting. If your yVel starts out at -50 (that would be when the user clicks a 45 degree angle with the dot), It won't halt it's journey upward until it is at 1275 pixels higher than where it started. If you did just over a 60 degree angle from the horizontal then it would be 5050 pixels (just over 12 and a half screens at 640x400 resolution). I would try increasing your gravity affects by a bit, and/or bumping down your launch velocity.

Your current initial velocity depends a lot on angle because you have a constant x velocity which the y velocity is based. If you want to better model projectile motion, you should have an initial velocity that does not depend on angle, and use that to calculate both x velocity and y velocity. By that I mean something similar to:

First,you must be sure that there has no problem in your code.The key is your algorithm.If your want to make a Physics Class game,your have to think about the Range Problem,you cannot let your dog jump or fly too fast to show it within the scene.The friends on top of me mentioned Direction Problem,but he hadn't solve the problem thatthe dog fly too fast or breaking of gravity and so on.I can give you a current idea,here is my code

//This is the unreal code
if(the dog.y >= ceiling)
{
the dog.y = ceiling +- the dog.height;
the dog.v -= the dog.v;
}
//and you can according to this concept,add wall or floor;

How to deal with the gravity,the gravity is closely linked to the floor.If the dog fall to floor,dog cannot fall under the floor ,so you must add some code to that.The gravity must be remove,and the dog's place must be on the floor when it's under floor.I haven't got any related code in my computer,but you can refer to my concept.