The question of discouragement and hope are as old as time itself. David dealt with it then, just as we do today.
When you feel discouraged or when your heart is sad, turn to Jesus. He is our hope, He is our salvation. With Jesus there is the encouragement of victory, even while we are in the midst of struggle.
The cure for discouragement is to focus on God, put your hope in Him for He will always be present to guard and guide you through everything you can come against. Praise the Lord through all you days and He will care for you always.