Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help printing this out in C++ #ifndef PRESIDENTS_H // Avoid redeclaring class Presidents. #define PRESIDENTS_H // This code is compiled only once #include
I need help printing this out in C++
#ifndef PRESIDENTS_H // Avoid redeclaring class Presidents. #define PRESIDENTS_H // This code is compiled only once #include // for class string using namespace std; // avoid having to write std:: as in std::string class Presidents { public: // class member functions //--constructors Presidents(); Presidents(int presidentNumber, string presidentName, string birthDeathDates, string dateTookOffice, string dateLeftOffice, string party, string previosOffice, string vicePresident); //--accessors int getPresidentNumber() const; // post: return the President's number string getPresidentName() const; // post: return the President's name string getDateBornDied() const; // post: return the President's birth and/or death dates string getDateTookOffice() const; // post: return the President's date s/he took office string getDateLeftOffice() const; // post: return the President's date s/he left office string getParty() const; // post: return the President's party(s) string getPreviousOffice() const; // post: return the President's previous office held string getVicePresident() const; // post: return the President's Vice President(s) string toString() const; // need a friend to output a President by just calling object name friend ostream& operator<<(ostream& os, const Presidents& pr); //--modifiers - not required at this time private: int presidentNumber; string presidentName; string birthDeathDates; string dateTookOffice; string dateLeftOffice; string party; string previousOffice; string vicePresident; }; //--Auxilliary functions // With these functions, Presidents objects can be // sorted and searched by the standard algorithms // currently we only use the overloaded == operater bool operator < (const Presidents & left, const Presidents & right); // aPres < aPres2 bool operator == (const Presidents & left, const Presidents & right); bool operator != (const Presidents & left, const Presidents & right); bool operator <= (const Presidents & left, const Presidents & right); bool operator > (const Presidents & left, const Presidents & right); bool operator >= (const Presidents & left, const Presidents & right); #endif // ifndef PRESIDENTS_H
output//
0 President Birth-Death Took office Left office Party Previous office Vice President 1 George Washington (1732 to 1799) April 30, 1789 March 4, 1797 Independent Commander-in-Chief; of the Continental Army (1775 to 1783) John Adams 2 John Adams (1735 to 1826) March 4, 1797 March 4, 1801 Federalist Vice President Thomas Jefferson 3 Thomas Jefferson (1743 to 1826) March 4, 1801 March 4, 1809 Democratic-Republican Vice President 1st term: Aaron Burr / 2nd term: George Clinton 4 James Madison (1751 to 1836) March 4, 1809 March 4, 1817 Democratic-Republican Secretary of State (1801 to 1809) George Clinton: 03/04/1809-04/20/1812; vacant: 04/20/1812 to 03/04/1813; Elbridge Gerry: 03/04/1813 to 11/23/1814; vacant: 11/23/1814 to 03/04/1817 5 James Monroe (1758 to 1831) March 4, 1817 March 4, 1825 Democratic-Republican Secretary of State (1811 to 1817) Daniel D. Tompkins 6 John Quincy Adams (1767 to 1848) March 4, 1825 March 4, 1829 Democratic-Republican Secretary of State (1817 to 1825) John C. Calhoun 7 Andrew Jackson (1767 to 1845) March 4, 1829 March 4, 1837 Democratic U.S. Senator (1823 to 1825) John C. Calhoun: 03/04/1829 to 12/28/1832; then Martin Van Buren 8 Martin Van Buren (1782 to 1862) March 4, 1837 March 4, 1841 Democratic Vice President Richard Mentor Johnson 9 William Henry Harrison (1773 to 1841) March 4, 1841 April 4, 1841 Whig Minister to Colombia (1828 to 1829) John Tyler 10 John Tyler (1790 to 1862) April 4, 1841 March 4, 1845 Whig: 04/04/1841 to 09/13/1841; no party: 09/13/1841 to 04/04/1845 Vice President vacant: no vice president 11 James K. Polk (1795 to 1849) March 4, 1845 March 4, 1849 Democratic Governor of Tennessee (1839 to 1841) George M. Dallas 12 Zachary Taylor (1784 to 1850) March 4, 1849 July 9, 1850 Whig U.S. Army Major general Millard Fillmore 13 Millard Fillmore (1800 to 1874) July 9, 1850 March 4, 1853 Whig Vice President vacant: no vice president 14 Franklin Pierce (1804 to 1869) March 4, 1853 March 4, 1857 Democratic U.S. Senator (1837 to 1842) William R. King: 03/04/1853 to 04/18/1853; vacant: no vice president 15 James Buchanan (1791 to 1868) March 4, 1857 March 4, 1861 Democratic United States Minister; to the United Kingdom (1853 to 1856) John C. Breckinridge 16 Abraham Lincoln (1809 to 1865) March 4, 1861 April 15, 1865 Republican U.S. Representative (1847 to 1849) Hannibal Hamlin : Andrew Johnson 17 Andrew Johnson (1808 to 1875) April 15, 1865 March 4, 1869 Democratic; National Union; no party Vice President vacant: no vice president 18 Ulysses S. Grant (1822 to 1885) March 4, 1869 March 4, 1877 Republican Commanding General of the Army (1864 to 1869) Schuyler Colfax; Henry Wilson 03/04/1873 to 09/22/1875; vacant: no vice president 19 Rutherford B. Hayes (1822 to 1893) March 4, 1877 March 4, 1881 Republican Governor of Ohio (1868 to 1872 & 1876 to 1877) William A. Wheeler 20 James A. Garfield (1831 to 1881) March 4, 1881 September 19, 1881 Republican U.S. Representative Chester A. Arthur 21 Chester A. Arthur (1829 to 1886) September 19, 1881 March 4, 1885 Republican Vice President vacant: no vice president 22 Grover Cleveland (1837 to 1908) March 4, 1885 March 4, 1889 Democratic Governor of New York (1883 to 1885) Thomas A. Hendricks: 03/04/1885 to 11/25/1885; vacant: no vice president 23 Benjamin Harrison (1833 to 1901) March 4, 1889 March 4, 1893 Republican U.S. Senator (1881 to 1887) Levi P. Morton 24 Grover Cleveland (1837 to 1908) March 4, 1893 March 4, 1897 Democratic President (1885 to 1889) Adlai Stevenson I 25 William McKinley (1843 to 1901) March 4, 1897 September 14, 1901 Republican Governor of Ohio (1892 to 1896) Garret Hobart: 03/04/1897 to 09/21/1899; vacant: no vice president; Theodore Roosevelt 26 Theodore Roosevelt (1858 to 1919) September 14, 1901 March 4, 1909 Republican Vice President vacant: no vice president; Charles W. Fairbanks 27 William Howard Taft (1857 to 1930) March 4, 1909 March 4, 1913 Republican Secretary of War (1904 to 1908) James S. Sherman: 03/04/1909 to 08/30/1912; vacant: no vice president 28 Woodrow Wilson (1856 to 1924) March 4, 1913 March 4, 1921 Democratic Governor of New Jersey (1911 to 1913) Thomas R. Marshall 29 Warren G. Harding (1865 to 1923) March 4, 1921 August 2, 1923 Republican U.S. Senator (1915 to 1921) Calvin Coolidge 30 Calvin Coolidge (1872 to 1933) August 2, 1923 March 4, 1929 Republican Vice President Charles G. Dawes 31 Herbert Hoover (1874 to 1964) March 4, 1929 March 4, 1933 Republican Secretary of Commerce (1921 to 1928) Charles Curtis 32 Franklin D. Roosevelt (1882 to 1945) March 4, 1933 April 12, 1945 Democratic Governor of New York (1929 to 1932) John Nance Garner; Henry A. Wallace; Harry S. Truman 33 Harry S. Truman (1884 to 1972) April 12, 1945 January 20, 1953 Democratic Vice President Alben W. Barkley 34 Dwight D. Eisenhower (1890 to 1969) January 20, 1953 January 20, 1961 Republican Supreme Allied Commander Europe (1949 to 1952) Richard Nixon 35 John F. Kennedy (1917 to 1963) January 20, 1961 November 22, 1963 Democratic U.S. Senator (1953 to 1960) Lyndon B. Johnson 36 Lyndon B. Johnson (1908 to 1973) November 22, 1963 January 20, 1969 Democratic Vice President Hubert Humphrey 37 Richard Nixon (1913 to 1994) January 20, 1969 August 9, 1974 Republican Vice President (1953 to 1961) Spiro Agnew: January 20, 1969 to October 10, 1973; vacant: no vice president: October 10, 1973 to December 6, 1973; Gerald Ford: December 6, 1973 to August 9, 1974 38 Gerald R. Ford (1913 to 2006) August 9, 1974 January 20, 1977 Republican Vice President vacant: no vice president; Nelson Rockefeller: 12/19/1974 to 01/20/1977 39 Jimmy Carter (b.1924) January 20, 1977 January 20, 1981 Democratic Governor of Georgia (1971 to 1975) Walter Mondale 40 Ronald Reagan (1911 to 2004) January 20, 1981 January 20, 1989 Republican Governor of California (1967 to 1975) George H. W. Bush 41 George H. W. Bush (b.1924) January 20, 1989 January 20, 1993 Republican Vice President Dan Quayle 42 Bill Clinton (b.1946) January 20, 1993 January 20, 2001 Democratic Governor of Arkansas; (1979 to 1981 & 1983 to 1992) Al Gore 43 George W. Bush (b.1946) January 20, 2001 January 20, 2009 Republican Governor of Texas (1995 to 2000) Dick Cheney 44 Barack Obama (b.1961) January 20, 2009 Incumbent(January 20, 2016) Democratic U.S. Senator (2005 to 2008) Joe Biden 45 Donald J. Trump (b.1946) January 20, 2017 Incumbent(January 20, 2025) Republican None Mike Pence
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started