Hi all I'm new here I've been working on a project that has a multiset class. I need a function that accepts a integer value and returns the value held there. The multiset is a data[2] where everything is stored where data[0] is the number and data[1] is how many times it is stored. The trouble I'm having is on how to throw an out of bounds exception if they try to access a section that is invalid. I can't make my own Expection since I can only turn in the multiset class that will be used by my professor. Heres my code and thanks in advance for your help.
int multiset::get(int i) {
if(i >= arraySize || i < 0)
//throw exception here
return data[i][0];
}