CHAPEL HILL — Voting, and doing it early, was the main message President Barack Obama brought to students at the University of North Carolina at Chapel Hill Wednesday afternoon.

Obama was in North Carolina campaigning for Democratic presidential nominee Hillary Clinton. But he first gave himself praise for what he had done in the presidency in the last eight years, noting that some students were just 10 years old at the time of his election. He then reminded North Carolinians that the progress he made during his presidency would only continue if Clinton is elected into office.

“North Carolina, all the progress that we've made over the last eight years, all the progress we hope to make over the next eight years — all of that goes out the window if we don't win this election," Obama said. "And we don't win this election, potentially, if we don’t win North Carolina."

The packed crowd outside of Eddie Smith Field House cheered in agreement with Obama’s remarks about Republican presidential nominee Donald Trump’s qualifications to be president.

“[Trump] says he'll be his own foreign policy adviser. He says he can do that because he has a 'good brain,'' Obama said. "Now, that is contestable."

He also addressed the continued controversy about Trump’s comments regarding women.

“Who calls women 'pigs,' or 'dogs,' or 'slobs,' and grades them on a scale of one to 10?” Obama said. “If you disrespect women before you are elected president, you will disrespect women when you’re in office.”

Obama compared Trump to former Republican presidential nominees nominees, Sen. John McCain and former Gov. Mitt Romney, whom he ran against in 2008 and 2012, respectively

“I ran against John McCain. I ran against Mitt Romney. I thought I’d be a better president, but I never thought that the republic was at risk if they were elected,” Obama said.

He stressed the fact that each vote counts while also mentioning the importance of voting in North Carolina. With 15 electoral votes at stake, Obama emphasized the importance of winning a swing state. 

“Back in 2008, I won North Carolina by 14,000 votes. That’s about two votes per precinct," he said. "If just two votes per precinct had gone the other way, I would have lost North Carolina. How can you say your vote doesn’t count?” 

Obama wrapped up his speech by pushing once again the importance of voting.

“You’ve got to do everything you can to make sure everybody votes  your friends, your family, your cousins, your uncle, your neighbors, your coworkers," he said. "Tell them this is the moment where America stands up for our best selves."

Early voting ends in North Carolina on Saturday, Nov. 5. Election Day is Tuesday, Nov. 8.