Ian 690d0eb356 README.md | 9 years ago | |
---|---|---|
README.md | 9 years ago | |
contributors.txt | 9 years ago |
It is important to check all input. A program input can be used to delete or damage data, obtain sensitive information or propogate worms. All input must be threated as potentially dangerous.
Classes can use public and private member variables. In this lab you will learn the importance of creating private variables. You will implement the validating system in the class BPlayer
.
The program that you will be editing is a Basketball Statistics Tracker. To understand the program you will need to learn basketball point system.
Note that these variables are declared private, and they are unsigned short. Remember that unsigned short does not have negative numbers.
The program lets the user add or remove stats. You will need to implement a system in the setters that validates if the user wrongly removes stats. For example, if the player has 0 assist, and the user removes an assist, the setter will need to verify and tell the user.
Instructions
In BPlayer.cpp
, add input validation in:
Run and verify that it works.
In BPlayerClient.cpp
,
void options(vector<BPlayer> &team, int &game)
, add input validation[1] http://cis1.towson.edu/~cssecinj/modules/cs0/input-validation-cs0-c/