I'm new here, but for a long time following this forum. I got task for some project to do, but I really don't know how to start. If someone can help me, I would be grateful. I didn't do anything. I don't realize this task and I don't know how to start, I don't know what I need to do in this task, or anything. I need the whole code. If anyone can solve this, please help me, it's an emergency.
You are given N open intervals on a line (the intervals do not include their endpoints). Your task is to write a program which finds the largest number of intervals that can be chosen so they don't intersect.
The first line of the standard input contains a number N (0<N<=5000), the number of intervals. The next N lines contain two integers li and ri (-10000< li < di <10000) which represent the left and right ends of the interval (1<=i<=N).
To the standard output in one line write the number of intervals which can be chosen so that they do not intersect.
P.S. The program is required to implement function, which checks whether two intervals have a common point: bool check (int beg1, int end1, int beg2, int end2).I am suffering with this for a long time and I can not resolve it, the task should be solved using the iostream library.