Race Horse C++ Program: Can anyone help me construct this program? PLEASE!!!!!!!!
Author |
Message |
lilbit20
|
Posted: Sun Jan 20, 2008 10:07 pm Post subject: Race Horse C++ Program: Can anyone help me construct this program? PLEASE!!!!!!!! |
|
|
Write a C++ program that calculates statistics about race horses.
Here is what your program should do:
2.) Input data on horses from a file called ?horsedata.txt? (provided with the assignment) which contains three pieces of information (fields) about each horse (record): the age, the weight, and the number of races won. These three numbers will appear IN THIS SAME ORDER in each record in the file.
3.) Your program should find the weight of the oldest horse. It should print out the weight, accompanied by some text that tells the user what this number is. This complete message might be "The weight of the oldest horse is 680 pounds.?
4.) Your program should also find the weight of the horse which won the most races. It doesn't need to print out anything about this horse. Rather, your program should then find the average age of horses which are heavier than this winning horse. It should print a result like ?Horses which are heavier than the horse which won the most races are on average 3.7 years old.?
NOTE: You need several loops ? one to input the data, one to find the oldest horse, one to find the horse which won the most races, and one to compare weights and find the average age. You can actually write the program with just two loops, doing the input and finding the oldest and most winning horse in one loop and finding the average in a second loop. But if you find it easier to use several loops do it that way ? at least at first.
NOTE: Because you need to go through the data at least twice you need to declare arrays for the age, weight and number of races won variables. Remember: always use subscripts with these variables. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|