By using density-functional-theory based DMol3 code, the structure optimizations are performed on a short charged single-walled carbon nanotube. Results show that the total energy of the nanotube exhibits a parabolic variation with respect to the amount of extra charge, and one negatively charged nanotube has the lowest total energy; thus the carbon nanotube has a positive electron affinity. When the charge is small, the variation of the atomic structure of the nanotube is also small, and neglecting the atomic structure variation leads to the qualitatively correct properties of the total energy and the energy of the highest occupied molecular orbital. When the extra charge is large, the end structure of the nanotube will be first affected and form into a trumpet shape. With the increasing of the extra charge, the nanotube end gradually becomes unstable, and this may lead to the ultimate destruction of the nanotube.