Finding the families of plant species

#include <iostream> #include <cstring> #include <vector> using namespace std; struct Species { string name; }; struct Genus { string name; vector species; }; struct Family { string name; vector genus; }; int main() { // Uses a tiny fraction of the USDA plant database vector<Species> trifolium = { {"Trifolium affine C.resl"}, {"Trifolium africanum Ser. – African clover"}, {"Trifolium albopurpureum Torr. & A. Gray – rancheria clover"}, {"Trifolium alexandrinum L. – Egyptian clover"}, {"Trifolium alpestre L. – owl-head clover"}, {"Trifolium alpinum L. – alpine clover"}, {"Trifolium amabile Kunth – Aztec clover"}, {"Trifolium ambiguum M. Bieb. – Kura clover"}, {"Trifolium amoenum Greene – showy Indian clover"}, {"Trifolium andersonii A. Gray – fiveleaf clover"}, {"Trifolium andinum Nutt. – Intermountain clover"}, {"Trifolium angustifolium L. – narrowleaf crimson clover"}, {"Trifolium apertum Bobrov – open clover"}, {"Trifolium argutum Banks & Sol. – sharp-tooth clover"}, {"Trifolium arvense L. – rabbitfoot clover"}, {"Trifolium attenuatum Greene – Rocky Mountain clover"}, {"Trifolium aureumollich – golden clover"}, {"Trifolium baccarinii Chiov."}, {"Trifolium badium Schreb."}, {"Trifolium barbigerum Torr. – bearded clover"}, {"Trifolium barnebyi (Isely) Dorn & Lichvar – Barneby's clover"}, {"Trifolium beckwithii W.H. Brewer ex S. Watson – Beckwith's clover"}, {"Trifolium bejariense Moric. – Bejar clover"}, {"Trifolium berytheum Boiss. & Blanche – Beirut clover"}, {"Trifolium bifidum A. Gray – notchleaf clover"}, {"Trifolium billardierei Spreng. – Labillardiere's clover"}, {"Trifolium bocconei Savi – Boccone's clover"}, {"Trifolium boissieri Guss. ex Soy.-Will. & Godr. – Boissier's clover"}, {"Trifolium bolanderi A. Gray –arasol clover"}, {"Trifolium brandegeei S. Watson – Brandegee's clover"}, {"Trifolium breweri S. Watson – forest clover"}, {"Trifolium buckwestiorum Isely – Santa Cruz clover"}, {"Trifolium burchellianum Ser. – Burchell's clover"}, {"Trifolium calcaricum J.L. Collins & T.F. Wieboldt – running glade clover"}, {"Trifolium campestre Schreb. – field clover"}, {"Trifolium canescens Willd. – graying clover"}, {"Trifolium carolinianum Michx. – Carolina clover"}, {"Trifolium cernuum Brot. – nodding clover"}, {"Trifolium cheranganiense J.B. Gillett – Cherangani clover"}, {"Trifolium cherleri L."}, {"Trifolium chilense Hook. & Arn. – Chilean clover"}, {"Trifolium ciliolatum Benth. – foothill clover"}, {"Trifolium clypeatum L. – shield clover"}, {"Trifolium cryptopodium Steud. ex A. Rich."}, {"Trifolium cyathiferum Lindl. – cup clover"}, {"Trifolium dalmaticum Vis. – Dalmatian clover"}, {"Trifolium dasyphyllum Torr. & A. Gray – alpine clover"}, {"Trifolium dasyurum C.resl"}, {"Trifolium dedeckerae J.M. Gillett – Dedecker's clover"}, {"Trifolium depauperatum Desv. – cowbag clover"}, {"Trifolium dichotomum Hook. & Arn. – branched Indian clover"}, {"Trifolium dichroanthum Boiss."}, {"Trifolium diffusum Ehrh. – diffuse clover"}, {"Trifolium douglasii House – Douglas' clover"}, {"Trifolium dubium Sibth. – suckling clover"}, {"Trifolium echinatum M. Bieb. –rickly clover"}, {"Trifolium eriocephalum Nutt. – woollyhead clover"}, {"Trifolium eriosphaerum Boiss. – woolly round-head clover"}, {"Trifolium fragiferum L. – strawberry clover"}, {"Trifolium friscanum (S.L. Welsh) S.L. Welsh – Frisco clover"}, {"Trifolium fucatum Lindl. – bull clover"}, {"Trifolium gemellumourr. ex Willd. – Spanish clover"}, {"Trifolium glanduliferum Boiss. – glandular clover"}, {"Trifolium globosum L. – round-head clover"}, {"Trifolium glomeratum L. – clustered clover"}, {"Trifolium gracilentum Torr. & A. Gray –inpoint clover"}, {"Trifolium grandiflorum Schreb. – large-flower hop clover"}, {"Trifolium gymnocarpon Nutt. – hollyleaf clover"}, {"Trifolium haussknechtii Boiss. – Haussknecht's clover"}, {"Trifolium haydeniiorter – Hayden's clover"}, {"Trifolium heldreichianum (Gibelli & Belli) Hausskn. – Heldreich's clover"}, {"Trifolium hirtum All. – rose clover"}, {"Trifolium howellii S. Watson – canyon clover"}, {"Trifolium hybridum L. – alsike clover"}, {"Trifolium incarnatum L. – crimson clover"}, {"Trifolium israeliticum Zohary & Katzn. – Israel clover"}, {"Trifolium isthmocarpum Brot."}, {"Trifolium jokerstii M. Vincent & R. Morgan – Jim's clover"}, {"Trifolium kingii S. Watson – King's clover"}, {"Trifolium lappaceum L. – burdock clover"}, {"Trifolium latifolium (Hook.) Greene – twin clover"}, {"Trifolium leibergii A. Nelson & J.F. Macbr. – Leiberg's clover"}, {"Trifolium lemmonii S. Watson – Lemmon's clover"}, {"Trifolium leucanthum M. Bieb."}, {"Trifolium ligusticum Balb. ex Loisel. – Ligurian clover"}, {"Trifolium longipes Nutt. – longstalk clover"}, {"Trifolium lucanicum Gasp. ex Guss."}, {"Trifolium lugardii Bullock – Lugard's clover"}, {"Trifolium lupinaster L. – lupine clover"}, {"Trifolium macraei Hook. & Arn. – Chilean clover"}, {"Trifolium macrocephalum (Pursh)oir. – largehead clover"}, {"Trifolium masaiense J.B. Gillett – Masai clover"}, {"Trifolium medium L. – zigzag clover"}, {"Trifolium meduseum Blanche ex Boiss. – Medusa clover"}, {"Trifolium michelianum Savi – bigflower clover"}, {"Trifolium micranthum Viv. – slender hop clover"}, {"Trifolium microcephalumursh – smallhead clover"}, {"Trifolium microdon Hook. & Arn. – thimble clover"}, {"Trifolium miegeanum Maire – miege clover"}, {"Trifolium minutissimum D. Heller & Zohary – dwarf clover"}, {"Trifolium monanthum A. Gray – mountain carpet clover"}, {"Trifolium montanum L. – mountain clover"}, {"Trifolium mucronatum Willd. ex Spreng. – cusp clover"}, {"Trifolium mutabileort."}, {"Trifolium nanum Torr. – dwarf clover"}, {"Trifolium neurophyllum Greene – White Mountain clover"}, {"Trifolium nigrescens Viv. – small white clover"}, {"Trifolium obscurum Savi"}, {"Trifolium obtusiflorum Hook. f. – clammy clover"}, {"Trifolium ochroleucum Huds. – sulphur clover"}, {"Trifolium oliganthum Steud. – fewflower clover"}, {"Trifolium olivaceum Greene – olive clover"}, {"Trifolium ornithopodioides L. – bird clover"}, {"Trifolium owyheense Gilkey – Owyhee clover"}, {"Trifoliumalaestinum Boiss. –alestine clover"}, {"Trifoliumallescens Schreb."}, {"Trifoliumallidum Waldst. & Kit."}, {"Trifoliumannonicum Jacq. – Hungarian clover"}, {"Trifoliumarryi A. Gray –arry's clover"}, {"Trifoliumatens Schreb."}, {"Trifoliumhilistaeum Zohary –alestine clover"}, {"Trifoliumhysodes Steven ex M. Bieb."}, {"Trifoliumilulare Boiss."}, {"Trifoliuminetorum Greene – woods clover"}, {"Trifoliumiorkowskii Rand. Morgan & A.L. Barber –iorkowski's clover"}, {"Trifoliumlumosum Douglas ex Hook. –lumed clover"}, {"Trifoliumolymorphumoir. –eanut clover"}, {"Trifoliumolystachyum Fresen."}, {"Trifoliumratense L. – red clover"}, {"Trifoliumroductum Greene – Shasta clover"}, {"Trifoliumurpureum Loisel –urple clover"}, {"Trifoliumurseglovei J.B. Gillett"}, {"Trifolium reflexum L. – buffalo clover"}, {"Trifolium repens L. – white clover"}, {"Trifolium resupinatum L. – reversed clover"}, {"Trifolium retusum L. – teasel clover"}, {"Trifolium rollinsii J.M. Gillett – Rollins' clover"}, {"Trifolium rubens L."}, {"Trifolium rueppellianum Fresen. – Rueppell's clover"}, {"Trifolium scabrum L. – rough clover"}, {"Trifolium scutatum Boiss. – shield clover"}, {"Trifolium semipilosum Fresen. – Kenya clover"}, {"Trifolium siskiyouense J.M. Gillett – Siskiyou clover"}, {"Trifolium spadiceum L. – brown moor clover"}, {"Trifolium spumosum L. – Mediterranean clover"}, {"Trifolium squamosum L. – sea clover"}, {"Trifolium squarrosum L."}, {"Trifolium stellatum L. – star clover"}, {"Trifolium steudneri Schweinf. – Steudner's clover"}, {"Trifolium stoloniferum Muhl. ex Eaton – running buffalo clover"}, {"Trifolium striatum L. – knotted clover"}, {"Trifolium strictum L."}, {"Trifolium subterraneum L. – subterranean clover"}, {"Trifolium suffocatum L. – suffocating clover"}, {"Trifolium sylvaticum Gérard ex Loisel."}, {"Trifolium tembense Fresen. – Tembien clover"}, {"Trifolium thalii Vill."}, {"Trifolium thompsonii Morton – Thompson's clover"}, {"Trifolium tomentosum L. – woolly clover"}, {"Trifolium trichocalyx A. Heller – Monterey clover"}, {"Trifolium trichocephalum M. Bieb."}, {"Trifolium tumens Steven ex M. Bieb."}, {"Trifolium uniflorum L. – oneflower clover"}, {"Trifolium usambarense Taub."}, {"Trifolium variegatum Nutt. – whitetip clover"}, {"Trifolium vavilovii Eig – Vavilov's clover"}, {"Trifolium vernumhil."}, {"Trifolium vesiculosum Savi – arrowleaf clover"}, {"Trifolium virginicum Small ex Small & Vail – Kates Mountain clover"}, {"Trifolium willdenovii Spreng. – tomcat clover"}, {"Trifolium wormskioldii Lehm. – cows clover"} }, arachis = { {"Arachis benthamii Handro"}, {"Arachis burkartii Handro"}, {"Arachis glabrata Benth. – rhizomaeanut"}, {"Arachis hagenbeckii Harms – rhizomaeanut"}, {"Arachis hypogaea L. –eanut"}, {"Arachis monticola Krapov. & Rigoni –eanut"}, {"Arachisaraguariensis Chodat & Hassl."}, {"Arachisintoi Krapov. & W.C. Greg. –intoeanut"}, {"Arachisrostrata Benth. – grassnut"}, {"Arachisusilla Benth."}, {"Arachis repens Handro – creepingeanut"}, {"Arachis rigonii Krapov. & W.C. Greg."}, {"Arachis villosa Benth."}, {"Arachis villosulicarpa Hoehne – groundnut"} }, allium = { {"Allium aaseae Ownbey – South Idaho onion"}, {"Allium abramsii (Ownbey & Aase) McNeal – Abrams' allium"}, {"Allium acuminatum Hook. – tapertip onion"}, {"Allium aflatunense B. Fedtsch."}, {"Allium allegheniense Small – Allegheny onion"}, {"Allium ampeloprasum L. – broadleaf wild leek"}, {"Allium amplectens Hook. – narrowleaf onion"}, {"Allium anceps Kellogg – twinleaf onion"}, {"Allium ascalonicum L. – wild onion"}, {"Allium atrorubens S. Watson – darkred onion"}, {"Allium atroviolaceum Boiss. – broadleaf wild leek"}, {"Allium bigelovii S. Watson – Bigelow's onion"}, {"Allium bisceptrum S. Watson – twincrest onion"}, {"Allium bolanderi S. Watson – Bolander's onion"}, {"Allium brandegeei S. Watson – Brandegee's onion"}, {"Allium brevistylum S. Watson – shortstyle onion"}, {"Allium burdickii (Hanes) A.G. Jones – narrowleaf wild leek"}, {"Allium burlewii Davidson – Burlew's onion"}, {"Allium campanulatum S. Watson – dusky onion"}, {"Allium canadense L. – meadow garlic"}, {"Allium carinatum L. [excluded]"}, {"Allium cepa L. – garden onion"}, {"Allium cernuum Roth – nodding onion"}, {"Allium chinense G. Don – rakkyo"}, {"Allium columbianum (Ownbey & Mingrone).eterson, Annable & Rieseberg – Columbian onion"}, {"Allium constrictum (Ownbey & Mingrone).eterson, Annable & Rieseberg – Grand Coulee onion"}, {"Allium coryi M.E. Jones – yellowflower onion"}, {"Allium cratericola Eastw. – Cascade onion"}, {"Allium crenulatum Wiegand – Olympic onion"}, {"Allium crispum Greene – crinkled onion"}, {"Allium cuthbertii Small – striped garlic"}, {"Allium denticulatum (Ownbey & Aase) McNeal – toothed onion"}, {"Allium diabolense (Ownbey & Aase) McNeal – serpentine onion"}, {"Allium dichlamydeum Greene – coastal onion"}, {"Allium dictuon H. St. John – Blue Mountain onion"}, {"Allium douglasii Hook. – Douglas' onion"}, {"Allium drummondii Regel – Drummond's onion"}, {"Allium elmendorfii M.E. Jones ex Ownbey – Elmendorf's onion"}, {"Allium falcifolium Hook. & Arn. – scytheleaf onion"}, {"Allium fibrillum M.E. Jones – Cuddy Mountain onion"}, {"Allium fimbriatum S. Watson – fringed onion"}, {"Allium fistulosum L. – welsh onion"}, {"Allium geyeri S. Watson – Geyer's onion"}, {"Allium glandulosum Link & Otto – gland onion"}, {"Allium gooddingii Ownbey – Goodding's onion"}, {"Allium haematochiton S. Watson – redskin onion"}, {"Allium hickmanii Eastw. – Hickman's onion"}, {"Allium hoffmanii Ownbey – beegum onion"}, {"Allium howellii Eastw. – Howell's onion"}, {"Allium hyalinum Curran – glassy onion"}, {"Allium jepsonii (Ownbey & Aase) S. Denison & McNeal – Jepson's onion"}, {"Allium kunthii G. Don – Kunth's onion"}, {"Allium lacunosum S. Watson –itted onion"}, {"Allium lemmonii S. Watson – Lemmon's onion"}, {"Allium macropetalum Rydb. – largeflower onion"}, {"Allium macrum S. Watson – rock onion"}, {"Allium madidum S. Watson – swamp onion"}, {"Allium membranaceum Ownbey –apery onion"}, {"Allium moly L. [excluded]"}, {"Allium monticola Davidson – San Bernardino Mountain onion"}, {"Allium munzii (Ownbey ex Traub) McNeal – Munz's onion"}, {"Allium neapolitanum Cirillo – white garlic"}, {"Allium nevadense S. Watson – Nevada onion"}, {"Allium nevii S. Watson – Nevius' garlic"}, {"Allium nigrum L. – black garlic"}, {"Allium obtusum Lemmon – red Sierra onion"}, {"Allium odorum L. – Chinese chives"}, {"Allium oleraceum L. – field garlic"}, {"Allium oxyphilum Wherry – lillydale onion"}, {"Alliumaniculatum L. – Mediterranean onion"}, {"Alliumarishii S. Watson –arish's onion"}, {"Alliumarryi S. Watson –arry's fringed onion"}, {"Alliumarvum Kellogg – small onion"}, {"Alliumasseyi N.H. Holmgren & A.H. Holmgren –assey's onion"}, {"Alliumeninsulare Lemmon ex Greene – Mexicali onion"}, {"Alliumerdulce S.V. Fraser –lains onion"}, {"Alliumlatycaule S. Watson – broadstemmed onion"}, {"Alliumleianthum S. Watson – manyflower onion"}, {"Alliumlummerae S. Watson – Tanners Canyon onion"}, {"Alliumorrum L. – garden leek"}, {"Alliumraecox Brandegee – early onion"}, {"Allium ×proliferum (Moench) Schrad. ex Willd. – garden onion"}, {"Alliumunctum L.F. Hend. – dotted onion"}, {"Allium robinsonii L.F. Hend. – Robinson's onion"}, {"Allium runyonii Ownbey – Runyon's onion"}, {"Allium sanbornii Alph. Wood – Sanborn's onion"}, {"Allium sativum L. – cultivated garlic"}, {"Allium schoenoprasum L. – wild chives"}, {"Allium scilloides Douglas ex S. Watson – fragile onion"}, {"Allium scorodoprasum L. – sand leek"}, {"Allium serra McNeal & Ownbey – jeweled onion"}, {"Allium serratum S. Watson [excluded]"}, {"Allium sharsmithiae (Ownbey & Aase) McNeal – Sharsmith's onion"}, {"Allium shevockii McNeal – Spanish Needle onion"}, {"Allium simillimum L.F. Hend. – simil onion"}, {"Allium siskiyouense Ownbey – Siskiyou onion"}, {"Allium speculae Ownbey & Aase – Little River Canyon onion"}, {"Allium sphaerocephalon L. – roundheaded leek"}, {"Allium stellatum Fraser ex Ker Gawl. – autumn onion"}, {"Allium textile A. Nelson & J.F. Macbr. – textile onion"}, {"Allium tolmiei (Hook.) Baker ex S. Watson – Tolmie's onion"}, {"Allium tribracteatum Torr. – threebract onion"}, {"Allium tricoccum Aiton – ramp"}, {"Allium triquetrum L. – threecorner leek"}, {"Allium tuberosum Rottler ex Spreng. – Chinese chives"}, {"Allium tuolumnense (Ownbey & Aase) S. Denison & McNeal – Rawhide Hill onion"}, {"Allium unifolium Kellogg – oneleaf onion"}, {"Allium ursinum L. – bear garlic"}, {"Allium validum S. Watson –acific onion"}, {"Allium victorialis L. – victory onion"}, {"Allium vineale L. – wild garlic"}, {"Allium yosemitense Eastw. – Yosemite onion"} }, leptospermum = { {"Leptospermum brachyandrum (F. Muell.) Druce"}, {"Leptospermum coriaceum (F. Muell. ex Miq.) Cheel – green teatree"}, {"Leptospermum erubescens Schauer"}, {"Leptospermum glabrescens Wakef. – smooth teatree"}, {"Leptospermum juniperinum Sm."}, {"Leptospermum laevigatum (Sol. ex Gaertn.) F. Muell. – Australian teatree"}, {"Leptospermum liversidgei R.T. Baker & H.G. Sm."}, {"Leptospermum macrocarpum (Maiden & Betche) Joy Thomps."}, {"Leptospermum morrisonii J. Thomp. – large-leaf yellow teatree"}, {"Leptospermum myrsinoides Schltdl. – heath teatree"}, {"Leptospermum obovatum Sweet"}, {"Leptospermumetersonii L.H. Bailey – common teatree"}, {"Leptospermumolygalifolim Salisb. – common teatree"}, {"Leptospermum rotundifolium (Maiden & Betche) F.A. Rodway ex Cheel"}, {"Leptospermum scoparium J.R. Forst. & G. Forst. – broom teatree"}, {"Leptospermum squarrosum Gaertn."}, {"Leptospermum trinervium (Sm.) Joy Thomps."} }, syzygium = { {"Syzygium aqueum (Burm. f.) Alston – watery roseapple"}, {"Syzygium aromaticum (L.) Merr. & L.M.erry – clove"}, {"Syzygium carolinense (Koidz.) Hosok. –ohnpei syzygium"}, {"Syzygium cumini (L.) Skeels – Javalum"}, {"Syzygium grande (Wight) Wight ex Walp. – sea apple"}, {"Syzygium jambos (L.) Alston – Malabarlum"}, {"Syzygium javanicum Miq. – Javalum"}, {"Syzygium malaccense (L.) Merr. & L.M.erry – Malaysian apple"}, {"Syzygium nervosum DC. – Daly River satinash"}, {"Syzygiumalauense (Kaneh.) Hosok. – orenged"}, {"Syzygiumaniculatum Gaertn. – brush cherry"}, {"Syzygium samarangense (Blume) Merr. & L.M.erry – syzygium"}, {"Syzygium sandwicense (A. Gray) Nied. – 'ohi'a ha"}, {"Syzygium stelechanthoides Kaneh. – Kosrae syzygium"}, {"Syzygium stelechanthum (Diels) Glassman – syzygium"}, {"Syzygium thompsonii (Merr.) N.Snow – atoto"} }, thymus = { {"Thymus capitatus (L.) Hoffsgg. & Link – thymus"}, {"Thymus kosteletzkyanus Opiz – Eurasian thyme"}, {"Thymusraecox Opiz – mother of thyme"}, {"SubThymusraecox Opiz ssp. arcticus (Durand) Jalas – creeping thyme"}, {"Thymusulegioides L. – lemon thyme"}, {"Thymus thracicus Velen."}, {"Thymus vulgaris L. – garden thyme"} }, ocimum = { {"Ocimum basilicum L. – sweet basil"}, {"Ocimum campechianum Mill. – least basil"}, {"Ocimum canum Sims – hoary basil"}, {"Ocimum gratissimum L. – African basil"}, {"Ocimum kilimandscharicum Guerke – hoary basil"}, {"Ocimum tenuiflorum L. – holy basil"} }, petroselinum = { {"Petroselinum crispum (Mill.) Nyman ex A.W. Hill – parsley"} }, cuminum = { {"Cuminum cyminum L. – cumin"} }, coriandrum = { {"Coriandrum sativum L. – coriander"} }, anethum = { {"Anethum graveolens L. – dill"} }; vector<Genus> fabaceae_genuses = { {"Trifolium L. – clover", trifolium}, {"Arachis L. – peanut", arachis} }, lily_genuses = { {"Allium L. – onion", allium} }, myrtle_genuses = { {"Leptospermum J.R. Forst. & G. Forst. – teatree", leptospermum}, {"Syzygium P. Br. ex Gaertn. – syzygium", syzygium} }, mint_family = { {"Thymus L. – thyme", thymus}, {"Ocimum L. – basil", ocimum} }, carrot_family = { {"Petroselinum J. Hill – parsley", petroselinum}, {"Cuminum L. – cumin", cuminum}, {"Coriandrum L. – coriander", coriandrum}, {"Anethum L. – dill", anethum} }; vector<Family> families = { {"Fabaceae – Pea family", fabaceae_genuses}, {"Liliaceae – Lily family", lily_genuses}, {"Myrtaceae – Myrtle family", myrtle_genuses}, {"Lamiaceae – Mint family", mint_family}, {"Apiaceae – Carrot family", carrot_family} }; // Find the families of selected species vector<string> of_interest = { "Arachisaraguariensis Chodat & Hassl.", "Syzygium javanicum Miq. – Javalum", "Allium victorialis L. – victory onion", "Ocimum gratissimum L. – African basil", "Allium schoenoprasum L. – wild chives", "Coriandrum sativum L. – coriander" }; for(const auto& family : families) { for(const auto& genus : family.genus) { for(const auto& specie_of_interest : of_interest) { for(const auto& genus_specie : genus.species) { if(specie_of_interest == genus_specie.name) { cout << "\"" << specie_of_interest << "\" belongs to the family \"" << family.name << "\"" << endl; } } } } } /* "Arachisaraguariensis Chodat & Hassl." belongs to the family "Fabaceae – Pea family" "Allium victorialis L. – victory onion" belongs to the family "Liliaceae – Lily family" "Allium schoenoprasum L. – wild chives" belongs to the family "Liliaceae – Lily family" "Syzygium javanicum Miq. – Javalum" belongs to the family "Myrtaceae – Myrtle family" "Ocimum gratissimum L. – African basil" belongs to the family "Lamiaceae – Mint family" "Coriandrum sativum L. – coriander" belongs to the family "Apiaceae – Carrot family" */ return 0; }