Sadly, neither of those tanks are a good container for your betta. In a container that small, you will need to change the water at least every other day because fish constantly release ammonia through their gills. This ammonia is kind of like pee--I don't know if you can imagine the horror of constantly having to swim in, breath in, and drink in urine all at once. Doesn't sound nice, does it?
The best solution I can give you is to go to Wal Mart or Target and get one of the 2 or 4 gallon Rubbermaid or Sterilite plastic storage bins. They are only about $2-$4, so if you don't have money for a real fish tank, this is the way to go. These are perfectly safe for fish--just rinse it out and fill with dechlorinated water. REMEMBER THE LID--bettas are jumpers. You will need to buy an adjustable heater for your fish--this is not optional. Bettas are tropical fish and need temperatures of 78-83 degrees to be comfortable, healthy and active. The cheapo heater pad things and other non-adjustable heaters are not good enough, they are a rip-off. You want a 25 Watt adjustable heater--like this one:
http://www.fosterandsmithaquatics.co...8&pcatid=11368
They are much cheaper online than they are in pet stores, sadly. You should expect to pay around $25 for that same heater in a pet store.
You will need to change the water on a 2 gallon every 3-4 days, and the 4 gallon would probably go for about 5-6 days.
You will need to change 100% of the water. That is the only way to remove 100% of the ammonia and keep your fish safe. They alternative to this is to get a larger aquarium with a filter and cycle it. Cycling is the process by which the aquarium is colonized by special bacteria that break down the poisonous ammonia into nitrite, and then more bacteria break down the poisonous nitrite into nitrate, which is much much less dangerous and is only poisonous to fish in large amounts. That means that if the tank is cycled, you only need to change about 30% of the water once a week rather than all of it multiple times a week. Save your money for a big tank, at least 3 gallons, and keep your fish in the rubbermaid bin with a heater until you can afford a real tank.
Please research the Nitrogen Cycle and how to cycle a tank using the fishless method. You will inevitably need one of these:
http://www.fosterandsmithaquatics.co...54&pcatid=4454
I suggest you get one sooner rather than later, this will let you know when you need to change your water with a simple test. Remember, the only acceptable readings for ammonia and nitrite are 0.
And as far as feeding the betta goes, I suggest getting a high quality betta pellet like OmegaOne betta buffet pellets, Atison's betta pellets, Ken's Betta Crumbles, or New Life Spectrum. These are all good brands. If you cannot find these particular ones, look in the ingredients--meat should be the first ingredient, preferably "whole" meat, like whole salmon, whole krill, whole fish meal--stuff like that. If you see "wheat" or "flour" anything before the meat--put it back, it's garbage. If you see MSG or copper sulfate in it, it's also garbage--put it back. I usually feed my fish 3 pre-soaked pellets a day--soaking them in tank water helps prevent bloating. 2 pellets twice a day is also a good idea if you have time for that.
Avoid freeze-dried foods, they are not good nutritionally, and they cause some of the worst constipation in fish I have ever seen. They're terrible. Frozen foods like hikari's spirulina brine shrimp and blood worms are a good treat, I usually use frozen foods twice a week. It's good to vary the diet with different pellets and frozen foods because no single pellet formula can provide your fish with complete nutrition.
In this hobby you learn very quickly that any product with a big picture of a betta on it is only intended to catch your eye and trick you into thinking it's a good product for a betta. It isn't. Don't be fooled and don't let the pet store people make you think that bettas come from tiny mud puddles and can live at room temperature or any of that other nonsense.