advice on reading in data for a project

closed account (NCRLwA7f)
Write your question here.

Hello, I am working on a little project that I hope to make an app for personal use.
I want to code a dichotomous key for local trees in my area. That is basically a series of questions that lead you to the correct identification of a tree.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Tree Identifcation Key

1. Leaves needle-like or scale-like; trees with cones ……………… see Conifers
1. Leaves fat and broad; trees without cones ……………………………… see Hardwoods
Conifers
1. Leaves needle-like ……………………………………………………………………………………………………… 2
1. Leaves scale-like, sometimes longer (¼ inch) pointed on the end and prickly to the touch;   
bark reddish-brown and fibrous; cones look like bluish-gray berries about 
¼ inch in diameter;   cones occur only on female trees …………………………………………………………… (A) eastern redcedar

2. Needles attached to the twig in bundles or clusters ……………… see Yellow Pines

2. Needles fat, attached to the twig separately, not in bundles or clusters ……………………………………… 3

3. Needles yellow-green, ½- to ¾-inch long; foliage has a feather-like appearance   and falls off in the winter; 
(in closely related pond cypress, needles are overlapping on   
branchlets that curve upwards); 
bark fibrous, scaly, reddish brown but weathers to ash-gray;   cones rounded like a ball; 
trees are found most commonly in swamps …………………… (SC) baldcypress

3. Needles are shiny-green above with 2 white stripes underneath, ¹/³ to ½ inch long;  cones light-brown, 
borne on the ends of the branches; 
trees evergreen;   drooping branches may hang to the ground ……………………………………………… (N) eastern hemlock


anyway, I can modify the text to suit a particular way of doing this, but I would really like some suggestions on how to save the data.

I was thinking maybe a linked list or binary tree.

I want the data saved so I can build a program that will let you identify the type of tree by answering questions, maybe by using a switch statement.

I want to keep it simple because I'm planning on sticking some of this code in objective c to make an app.
Last edited on
I'd use a table. The more items you match on a given line the more likely you have found the right name.
Separate the data fields by a comma or some other char that's not going to be used to describe some part of the tree, such as ,|;:~.

Name, Type, Height, Skin, Leaves, etc...
Oak, hardwood, 80ft, rough, flat green/redish
Pine, softwood, 100ft, course, long needles green or brown
Topic archived. No new replies allowed.