Let's talk nutrition for a minute. If you're trying to cut down on weight, simply eating less won't help you if what you're eating is crap, so toss out your chips and sodas and Little Debbie snacks. If you don't eat those already, great. You need good, clean, natural and nutrient dense foods. Learn to cook for yourself and prepare meals in advance if you don't know how already! And there is tons of information online about what foods to eat, way too much to put in just one post.
To lose weight, you need a calorie deficit, meaning you need to eat less than you burn a day. Find out what your resting metabolic rate is and then subtract 300-400 calories from it. NOTE: If you are doing a workout program, you need to have an idea of how many calories you burn during the workout and add that to your calorie deficit.
Example: Joe Schmo is 170 pounds, 5'10, 26 years old, and is at 23% body fat. His RMR is about 1844 calories a day. To lose weight, he needs to be eating about 1400 calories a day, at about a 50% protein, 30% carbs, and 20% fat (GOOD fats, like from avocados and nuts) ratio. To find out your RMR, go here: http://www.bodybuilding.com/fun/calrmr.htm
Now, if he's exercising as well (which I HIGHLY recommend, you'll lose weight faster, be healthier, and prevent losing muscle mass), and he's burning an average of 400-500 calories per workout (I recommend investing in a heart rate monitor for workouts, they tell you how many calories were burned), he actually needs to be eating 1900-2000 calories a day, to make up for what he burned. He's still at a deficit, and he's not starving himself, which will actually enable faster fat loss.
Now if you're trying to gain weight in muscle, that's different. You still need to eat the good foods, but you need to eat a LOT of them. Use this formula to figure out how many calories you need to eat a day:
Step 1: [100-body fat percentage (BF)] / 100 x weight = Lean Body Mass (LBM)
To find out your body fat percentage, go here: https://www.active.com/fitness/calculators/bodyfat
Step 2: LBM x 10 = Resting Metabolic Rate (RMR). This is the minimum amount of calories you'd need a day to maintain weight if you had no activity.
Step 3: RMR x .3 = Caloric Modification for Recovery (CMR)
Step 4: RMR = CMR = Resting Metabolic Rate Modified for Recovery (RMR2)
Step 5: RMR2 + 600 = Calorie intake to maintain weight (CIM)
Step 6: Your body fat percentage will affect this step
More than 20% BF: CIM + 10% of CIM = Calories needed to build/bulk
Between 20% and 10%: CIM + 15% of CIM
Less than 10%: CIM + 20% of CIM
You're going to want to do the muscle gaining in building, bulking and cutting phases. I suggest spending 3 weeks building, 6 weeks bulking, and 3 weeks cutting.
The above calculation is for the start of the building phase. For bulking, do the same calculations, but input your new body fat percentage and weight. Do this for 1 month. Finally for the cutting phase, do the same formula with your current weight and BF percentage, but also do this:
BF more than 20%: CIM - 20% of CIM
Between 20% and 10%: CIM - 15% of CIM
Less than 10%: CIM - 10% of CIM