Program for identifying and displaying individuals alive during specific years
Budget: £20 – £250 GBP
Suppose a text file people.txt contains birth and death years for a number of people, one per line,
like 1685 1750 Bach 1770 1827 Beethoven 1803 1869 Berlioz 1838 1875 Bizet 1833 1897 Brahms 1810 1849 Chopin 1685 1759 Handel 1732 1809 Haydn 1756 1791 Mozart 1782 1840 Paganini 1797 1828 Schubert .
You may assume that the file is in the correct format, that each entry has two years, and that people’s names consist of a single word. The records need not be in any special order. You can read this using the class ifstream, which is derived from istream, like so: #include ... ifstream in("people.txt"); ... istream operations ... The constructor opens the file; you can then test in to see whether it succeeded.
What I would like you to program for me:
Define a class to hold a record describing a person.
Write a function to read a series of person records from a file into a vector of person objects
Write a main program that reads from standard input a series of years, one per line, like 1700 1812 1880 1500 1776 You may assume that the input is in the specified format. Again the lines are in no special order. For each input line, your program should produce on the standard output a header line and a line for each of the listed people who were alive in that year, in the order they occur in the file. For example, the above inputs might result in * People alive in 1700: Bach (1685-1750) Handel (1685-1759) * People alive in 1812: Beethoven (1770-1827) Berlioz (1803-1869) Chopin (1810-1849) Paganini (1782-1840) Schubert (1797-1828) * People alive in 1880: Brahms (1833-1897) * People alive in 1500: * People alive in 1776: Beethoven (1770-1827) Haydn (1732-1809) Mozart (1756-1791) If there were no people alive in that particular year, only the header will be printed.
like 1685 1750 Bach 1770 1827 Beethoven 1803 1869 Berlioz 1838 1875 Bizet 1833 1897 Brahms 1810 1849 Chopin 1685 1759 Handel 1732 1809 Haydn 1756 1791 Mozart 1782 1840 Paganini 1797 1828 Schubert .
You may assume that the file is in the correct format, that each entry has two years, and that people’s names consist of a single word. The records need not be in any special order. You can read this using the class ifstream, which is derived from istream, like so: #include ... ifstream in("people.txt"); ... istream operations ... The constructor opens the file; you can then test in to see whether it succeeded.
What I would like you to program for me:
Define a class to hold a record describing a person.
Write a function to read a series of person records from a file into a vector of person objects
Write a main program that reads from standard input a series of years, one per line, like 1700 1812 1880 1500 1776 You may assume that the input is in the specified format. Again the lines are in no special order. For each input line, your program should produce on the standard output a header line and a line for each of the listed people who were alive in that year, in the order they occur in the file. For example, the above inputs might result in * People alive in 1700: Bach (1685-1750) Handel (1685-1759) * People alive in 1812: Beethoven (1770-1827) Berlioz (1803-1869) Chopin (1810-1849) Paganini (1782-1840) Schubert (1797-1828) * People alive in 1880: Brahms (1833-1897) * People alive in 1500: * People alive in 1776: Beethoven (1770-1827) Haydn (1732-1809) Mozart (1756-1791) If there were no people alive in that particular year, only the header will be printed.