CIS22A
- Fall 2019 - Lab Exercise 8
due Wednesday, 11/13 8:30 am
Lab
exercises are not accepted late.
Put your name, Lab
Exercise 8, and compiler and the operating system used in a
comment at the top
of your program. Email only your source code. Your source code should
be sent as an attachment (with the name ex8.cpp).
Use
"Ex8" as the subject of
your
email submission
Program
Requirements
Write
a function that takes a char argument and returns a random int
- between 1 and 15, if the argument is a B
- between 16 and 30, if the argument is a I
- between 31 and 45, if the argument is a N
- between 46 and 60, if the argument is a G
- between 61 and 75, if the argument is a O
The
function should return 0, if the argument in not 'B', 'I', 'N', 'G', or
'O'. Use a switch in your function and use this main() to test
your function:
int
main()
{
cout << yourfunction('B') << endl;
cout << yourfunction('I') << endl;
cout << yourfunction('N') << endl;
cout << yourfunction('G') << endl;
cout << yourfunction('O') << endl;
cout << yourfunction('Z') << endl;
}