![]() Patchbay for an old analog computer. |
Scientific Computing (P05 Spring,
2004)
[Grades] [Compilers] [Links] [Syllabus] [Examples] [Exams] [Reference] |
My Output for Program 2.65
The Peter Minuit Problem
Slightly adapting the code from Fig 2.21 of Deitel to compute the present value of Manhattan assuming Peter Minuit paid a fair price of $24 for it 1626 and the interest over 378 years since is 9%, compounded yearly. Apparently my console accommodates a maximum of 298 lines, so the first few numbers are missing. The final figure of $3368429508597859.00 is more than three thousand trillion dollars...probably an underestimate?
By the way, "cout.setf(ios::fixed)" is the way you've got to format the money figure with the g++ compiler.
Year Amount
1707 25808.19
1708 28130.93
1709 30662.71
1710 33422.36
1711 36430.37
1712 39709.10
1713 43282.92
1714 47178.38
1715 51424.44
1716 56052.64
1717 61097.38
1718 66596.14
1719 72589.79
1720 79122.87
1721 86243.93
1722 94005.89
1723 102466.42
1724 111688.39
1725 121740.35
1726 132696.98
1727 144639.71
1728 157657.28
1729 171846.44
1730 187312.62
1731 204170.75
1732 222546.12
1733 242575.27
1734 264407.04
1735 288203.68
1736 314142.01
1737 342414.79
1738 373232.12
1739 406823.01
1740 443437.08
1741 483346.42
1742 526847.60
1743 574263.88
1744 625947.63
1745 682282.92
1746 743688.38
1747 810620.33
1748 883576.16
1749 963098.02
1750 1049776.84
1751 1144256.75
1752 1247239.86
1753 1359491.45
1754 1481845.68
1755 1615211.79
1756 1760580.85
1757 1919033.13
1758 2091746.11
1759 2280003.26
1760 2485203.55
1761 2708871.87
1762 2952670.34
1763 3218410.67
1764 3508067.63
1765 3823793.72
1766 4167935.15
1767 4543049.32
1768 4951923.76
1769 5397596.89
1770 5883380.61
1771 6412884.87
1772 6990044.51
1773 7619148.51
1774 8304871.88
1775 9052310.35
1776 9867018.28
1777 10755049.93
1778 11723004.42
1779 12778074.82
1780 13928101.55
1781 15181630.69
1782 16547977.45
1783 18037295.42
1784 19660652.01
1785 21430110.69
1786 23358820.65
1787 25461114.51
1788 27752614.82
1789 30250350.15
1790 32972881.67
1791 35940441.02
1792 39175080.71
1793 42700837.97
1794 46543913.39
1795 50732865.59
1796 55298823.50
1797 60275717.61
1798 65700532.20
1799 71613580.09
1800 78058802.30
1801 85084094.51
1802 92741663.01
1803 101088412.69
1804 110186369.83
1805 120103143.11
1806 130912425.99
1807 142694544.33
1808 155537053.32
1809 169535388.12
1810 184793573.05
1811 201424994.62
1812 219553244.14
1813 239313036.11
1814 260851209.36
1815 284327818.21
1816 309917321.85
1817 337809880.81
1818 368212770.08
1819 401351919.39
1820 437473592.14
1821 476846215.43
1822 519762374.82
1823 566540988.55
1824 617529677.52
1825 673107348.50
1826 733687009.86
1827 799718840.75
1828 871693536.42
1829 950145954.70
1830 1035659090.62
1831 1128868408.78
1832 1230466565.57
1833 1341208556.47
1834 1461917326.55
1835 1593489885.94
1836 1736903975.67
1837 1893225333.48
1838 2063615613.50
1839 2249341018.71
1840 2451781710.40
1841 2672442064.33
1842 2912961850.12
1843 3175128416.63
1844 3460889974.13
1845 3772370071.80
1846 4111883378.26
1847 4481952882.31
1848 4885328641.71
1849 5325008219.47
1850 5804258959.22
1851 6326642265.55
1852 6896040069.45
1853 7516683675.70
1854 8193185206.51
1855 8930571875.10
1856 9734323343.86
1857 10610412444.80
1858 11565349564.84
1859 12606231025.67
1860 13740791817.98
1861 14977463081.60
1862 16325434758.94
1863 17794723887.25
1864 19396249037.10
1865 21141911450.44
1866 23044683480.98
1867 25118704994.27
1868 27379388443.75
1869 29843533403.69
1870 32529451410.02
1871 35457102036.92
1872 38648241220.25
1873 42126582930.07
1874 45917975393.78
1875 50050593179.22
1876 54555146565.35
1877 59465109756.23
1878 64816969634.29
1879 70650496901.37
1880 77009041622.50
1881 83939855368.52
1882 91494442351.69
1883 99728942163.34
1884 108704546958.04
1885 118487956184.26
1886 129151872240.85
1887 140775540742.52
1888 153445339409.35
1889 167255419956.19
1890 182308407752.25
1891 198716164449.95
1892 216600619250.45
1893 236094674982.99
1894 257343195731.46
1895 280504083347.29
1896 305749450848.54
1897 333266901424.91
1898 363260922553.16
1899 395954405582.94
1900 431590302085.40
1901 470433429273.09
1902 512772437907.67
1903 558921957319.36
1904 609224933478.10
1905 664055177491.13
1906 723820143465.33
1907 788963956377.21
1908 859970712451.16
1909 937368076571.77
1910 1021731203463.23
1911 1113687011774.92
1912 1213918842834.66
1913 1323171538689.78
1914 1442256977171.86
1915 1572060105117.33
1916 1713545514577.89
1917 1867764610889.90
1918 2035863425869.99
1919 2219091134198.29
1920 2418809336276.13
1921 2636502176540.98
1922 2873787372429.67
1923 3132428235948.34
1924 3414346777183.69
1925 3721637987130.23
1926 4056585405971.95
1927 4421678092509.42
1928 4819629120835.27
1929 5253395741710.45
1930 5726201358464.39
1931 6241559480726.18
1932 6803299833991.54
1933 7415596819050.78
1934 8083000532765.35
1935 8810470580714.23
1936 9603412932978.51
1937 10467720096946.58
1938 11409814905671.77
1939 12436698247182.23
1940 13556001089428.63
1941 14776041187477.21
1942 16105884894350.16
1943 17555414534841.68
1944 19135401842977.43
1945 20857588008845.40
1946 22734770929641.48
1947 24780900313309.22
1948 27011181341507.05
1949 29442187662242.69
1950 32091984551844.54
1951 34980263161510.55
1952 38128486846046.50
1953 41560050662190.69
1954 45300455221787.85
1955 49377496191748.77
1956 53821470849006.16
1957 58665403225416.72
1958 63945289515704.23
1959 69700365572117.61
1960 75973398473608.19
1961 82811004336232.94
1962 90263994726493.91
1963 98387754251878.38
1964 107242652134547.44
1965 116894490826656.70
1966 127414995001055.84
1967 138882344551150.84
1968 151381755560754.44
1969 165006113561222.38
1970 179856663781732.38
1971 196043763522088.31
1972 213687702239076.28
1973 232919595440593.19
1974 253882359030246.56
1975 276731771342968.78
1976 301637630763836.00
1977 328785017532581.25
1978 358375669110513.62
1979 390629479330459.81
1980 425786132470201.25
1981 464106884392519.38
1982 505876503987846.19
1983 551405389346752.38
1984 601031874387960.25
1985 655124743082876.62
1986 714085969960335.50
1987 778353707256765.88
1988 848405540909874.75
1989 924762039591763.75
1990 1007990623155022.25
1991 1098709779238974.50
1992 1197593659370482.25
1993 1305377088713825.75
1994 1422861026698070.25
1995 1550918519100896.50
1996 1690501185819977.50
1997 1842646292543775.75
1998 2008484458872715.50
1999 2189248060171260.00
2000 2386280385586673.50
2001 2601045620289474.50
2002 2835139726115527.50
2003 3090302301465925.00
2004 3368429508597859.00