CIS 150 Lab: Sequential (text) file input/output

Objectives

  • Open a sequential access file
  • Write to a sequential access file
  • Handle errors when opening a file for processing
  • Close a file

Requirements

Modify the supplied program (seqFileIO.cpp) to make it work properly. You will also need the file pres.txt

Program to be modified

Example run of program

Before adding last two presidents: 1. George Washington (1789) 2. John Adams (1797) 3. Thomas Jefferson (1801) 4. James Madison (1809) 5. James Monroe (1817) 6. John Quincy Adams (1825) 7. Andrew Jackson (1829) 8. Martin Van Buren (1837) 9. William Henry Harrison (1841) 10. John Tyler (1841) 11. James K. Polk (1845) 12. Zachary Taylor (1849) 13. Millard Fillmore (1850) 14. Franklin Pierce (1853) 15. James Buchanan (1857) 16. Abraham Lincoln (1861) 17. Andrew Johnson (1865) 18. Ulysses S. Grant (1869) 19. Rutherford B. Hayes (1877) 20. James A. Garfield (1881) 21. Chester Arthur (1881) 22. Grover Cleveland (1885) 23. Benjamin Harrison (1889) 24. Grover Cleveland (1893) 25. William McKinley (1897) 26. Theodore Roosevelt (1901) 27. William Howard Taft (1909) 28. Woodrow Wilson (1913) 29. Warren G. Harding (1921) 30. Calvin Coolidge (1923) 31. Herbert Hoover (1929) 32. Franklin D. Roosevelt (1933) 33. Harry S. Truman (1945) 34. Dwight D. Eisenhower (1953) 35. John F. Kennedy (1961) 36. Lyndon B. Johnson (1963) 37. Richard Nixon (1969) 38. Gerald Ford (1974) 39. Jimmy Carter (1977) 40. Ronald Reagan (1981) 41. George Bush (1989) 42. Bill Clinton (1993) 43. George W. Bush (2001) After adding last two presidents: 1. George Washington (1789) 2. John Adams (1797) 3. Thomas Jefferson (1801) 4. James Madison (1809) 5. James Monroe (1817) 6. John Quincy Adams (1825) 7. Andrew Jackson (1829) 8. Martin Van Buren (1837) 9. William Henry Harrison (1841) 10. John Tyler (1841) 11. James K. Polk (1845) 12. Zachary Taylor (1849) 13. Millard Fillmore (1850) 14. Franklin Pierce (1853) 15. James Buchanan (1857) 16. Abraham Lincoln (1861) 17. Andrew Johnson (1865) 18. Ulysses S. Grant (1869) 19. Rutherford B. Hayes (1877) 20. James A. Garfield (1881) 21. Chester Arthur (1881) 22. Grover Cleveland (1885) 23. Benjamin Harrison (1889) 24. Grover Cleveland (1893) 25. William McKinley (1897) 26. Theodore Roosevelt (1901) 27. William Howard Taft (1909) 28. Woodrow Wilson (1913) 29. Warren G. Harding (1921) 30. Calvin Coolidge (1923) 31. Herbert Hoover (1929) 32. Franklin D. Roosevelt (1933) 33. Harry S. Truman (1945) 34. Dwight D. Eisenhower (1953) 35. John F. Kennedy (1961) 36. Lyndon B. Johnson (1963) 37. Richard Nixon (1969) 38. Gerald Ford (1974) 39. Jimmy Carter (1977) 40. Ronald Reagan (1981) 41. George Bush (1989) 42. Bill Clinton (1993) 43. George W. Bush (2001) 44. Barack Obama (2009) 45. Donald Trump (2016)

Rubric

Points (10 points total)
  • 4 points: for getting part I working properly
  • 1 point: for getting part II working properly
  • 5 points: for getting part III working properly