Link to home
Start Free TrialLog in
Avatar of mssabur
mssabur

asked on

students data entry with c++ languge

hello, please send me a program with C++ : Student Information
1- It has a Function that save student name (over 100 names, length over 20 character) & Id (5 digits) & lessons (over 2 lessons) and end of data entry be -1 for id number.
2-It has a Function that get student information and sort by id.
3-It has a function that get id and if exist show informations 's student.
4- please with above function write a program.
thank a lot.
ASKER CERTIFIED SOLUTION
Avatar of mish33
mish33
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mssabur
mssabur

ASKER

Please help me to improve my solution myself source is here:
#incloude <iostream.h>
#incloude <conio.h>

void getstu (char,char,int);
void sort (int);
void search(int&);

class charlesson:
{
      private:
      char lsn1,lsn2;
      public:
            void showlsn()
            {
                  char ans=1
                  cout<<"Please Enter ID's student:"<<lsn1<<'\t'<<lsn2;      
                  cin>>stuId;
                  
            }
      

}
//FONCTIONS
void getstu (char[20] name,charlessson lsn, int stuId)
{
      
}
void sort (int stuId);
{
      //sort
}
void search(int& stuId)
{
      //binary search      
}
//END FONCTIONS
int main()
{
      char ans1='y'
      char ans2='y'
      int count=1;
      cout<<"Pleas enter student's informations\n"
      
      while(count<=100)
      {
            getstu();      
            count+=1;
            if (cout>100) cout<<"Sorry stongly we shall only up to 100 student
 registrated.";
            break  ;
      }            
      cout<<"Would you like to have a quick sort? Please enter (y/n)";
      cin>>ans1;
      if (ans1=='y'|| ans1=='Y')
      {
            sort();
      
      else break;
      }
      cout<<"Would you like to have a quick search? Please enter (y/n)";
      cin>>ans2;
      if (ans2=='y'|| ans2=='Y')
      {
            search();
      
      else break;
      }                                    

return(0);
}
//Please  help to complete, so it has very error
Don't forget to end _each_ statement with ';' !

Start with data structure to hold your student info. Safe bet is list<studentinfo*>.
Then define class studentinfo (I think it's a more meaningful name than charlesson). It should has 5-digit id (99999 - use unsigned int or long), name, lesson1, lesson2 data members
and members for sorting (compare) and printing student info. Don't forget destructor to deallocate data.

getstu() better return studentinfo* (NULL for id==-1) and you can push_back it to the list.
For sorting use STL sort based on bool studentinfo::idsorted(const studentinfo* si1, const studentinfo* si2).

Post your progress.