Ulysses S. Grant (born Hiram Ulysses Grant; April 27, 1822 – July 23, 1885) was the 18th President of the United States (1869–1877) as well as military commander during the Civil War and post-war Reconstruction periods. Under Grant's command, the Union Army defeated the Confederate military and ended the Confederate States of America. Grant began his lifelong career as a soldier after graduating from the United States Military Academy at West Point in 1843. Fighting in the Mexican–American War, he was a close observer of the techniques of Generals Zachary Taylor and Winfield Scott. He resigned from the Army in 1854, then struggled to make a living in St. Louis and Galena, Illinois.