title: write a program that get data of 100 students and display merit list
body: <p>Recently I have come across a peculiar question in c++:</p>
  
  <blockquote>
    <p>create a class named student which contains the following members: roll,name &amp; course.
    Write a program to read the information of n students and then display
    the information of the students <em>within an input roll no range</em>. Use
    constructors &amp; member functions.</p>
  </blockquote>
  
  <p>How is it possible to display info within a an input roll_no range while there is no database in use ? It sounds peculiar.</p>
  
  <p>I have a simple solution as given below:
  But,I want a better algorithm which is more economic in terms of memory and processor speed.    </p>
  
  <pre><code> #include&lt;iostream.h&gt;
       #include&lt;conio.h&gt;
       class student
       {
         int roll;
         char name[100];
         char course[100];
         public:void getData();
            void disp(int r1,int r2)
            {
              if(roll&gt;=r1 &amp;&amp; roll&lt;=r2)
              cout&lt;&lt;"\nroll_no:"&lt;&lt;roll&lt;&lt;"\tname:"&lt;&lt;name&lt;&lt;"\tcourse:"&lt;&lt;course;
            }
       };
       void student::getData()
       {
          cout&lt;&lt;"\nEnter roll_no,name and course\n";
          cin&gt;&gt;roll&gt;&gt;name&gt;&gt;course;
       }
       void main()
       {
         student s[100];
         int n,r1,r2;
         clrscr();
         cout&lt;&lt;"\nEnter no of students\n";
         cin&gt;&gt;n;
         for(int i=0;i&lt;n;i++)
          s[i].getData();
         cout&lt;&lt;"\nEnter the range\n";
         cin&gt;&gt;r1&gt;&gt;r2;
         for(int j=0;j&lt;n;j++)
          s[j].disp(r1,r2);
         getch();
       }
  </code></pre>