What was the point of the cannon attacks?

Why is keeping the high ground important in a battle?

Cannons destroy more things than ordinary gunfire.

The high ground is a natural defensive position. The enemy must run up hill to dislodge you.

How did Gettysburg lead to the end of the war?

Read the Aftermath in this site.

http://www.gettysbg.com/battle.shtml

the failure of Pickett's Charge caused the battle to be over

That isn't the answer to the question. You'll find the answer in the site above.

i don't see it

You need to read all three paragraphs to understand why the Battle of Gettysburg lead to the end of the war.

"The Aftermath

"With the failure of Pickett's Charge, the battle was over - the Union was saved. Lee's retreat began on the afternoon of July 4. Behind him, this small town of only 2,400 was left with a total (from both sides) of over 51,000 casualties. Over 172,000 men and 634 cannon had been positioned in an area encompassing 25 square miles. Additionally, an estimated 569 tons of ammunition was expended and, when the battle had ended, 5,000 dead horses and the other wreckage of war presented a scene of terrible devastation.

"The Confederate army that staggered back from the fight at Gettysburg was physically and spiritually exhausted. Lee would never again attempt an offensive operation of such proportions. Meade, though he was criticized for not immediately pursuing Lee's army, had carried the day in the battle that has become known as the High Water Mark of the Confederacy.

"The war was to rage for two more terrible and tormenting years but the Confederacy never recovered from the losses of Gettysburg. And through the deepening twilight of Confederate military might, all who had been to Gettysburg would remember."