Iterative Improvement

In this lab, we're going to lean on the lessons from the last couple days to write a program to provide some information about some sports statistics. I've copy-pasted info from two pages ( page 1 page 2 ) to make these two files ( basketball.txt baseball.txt ). Download those two files first.

Now, something we clearly should be able to do with these files is write a program where the user enters a heading (like 3P%), and get back which team had the highest number for that column, and the value in that column:

taylor@kurt:~/zee/temp$ ./a.out 
Filename? basketball.txt
Column heading? 3P%
Golden State Warriors: 39.8

We're going to write this program, in such a way that it will work for either file. Now, given that team names are different lengths, and you don't know in advance which column you need, it seems hard, but by working on solving smaller problems along the way, we can build up to a full solution.

Here are the steps we're going to follow in a file called stats.cpp:

//get a filename and column heading from the user
//figure out which column has that header
//for each line
  //get that team's name
  //get that team's value at that column
  //track the largest value seen so far
//print out the team name and value which was the largest

For this problem, pick small chunks to work on at a time, then combine those chunks to make a full program.

Helpful tips: 1. A string and a char can be concatenated together. 2. Team names don't have numbers in them.

Submit with the command: submit lab05 stats.cpp