Article Two of the United States Constitution
Congress has come up with a "line of succession"  a list of the people who would become President, and in what order, if both the Presidency and Vice Presidency became vacant.  As of 2016, the order is: the Speaker of the House of Representatives; the President pro tempore of the Senate; and then the fifteen Cabinet Secretaries, in order of when their Departments were first created.