c++ is a bit advanced for me, but I *think* you can use a vector
declare a 2d vector
Code:
std::vector<std::vector<int> > intervals;
add some data
Code:
loop(while input is stored) {
intervals.push_back(std::vector<int>(2)); // prepare a set of end pts
// request end pt 1 and end pt 2
std::cin >> intervals[loop_counter][0] // end pt 1
std::cin >> intervals[loop_counter][1] // end pt 2
}
I *think* the function would want to check intervals[0][0], intervals[0][1] against the other sets in the vector, so use a loop starting at index pos 1
Code:
for(int i=1; i < intervals.size(); ++i) {
if(check(intervals[0][0], intervals[0][1], intervals[i][0], intervals[i][1]) == false)
++count;
}
oops; forgot the function
Code:
bool check(int s1, int e1, int s2, int e2) {
return (s2 >= s1 && e2 <= e1);
}
maybe something like that.
HTH