1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help

Discussion in 'C' started by jomo, Jun 26, 2007.

  1. jomo

    jomo New Member

    Joined:
    Jun 26, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    I have start learning c++ and face with this problem.
    My problem is a minimization problem. Students are to be matched to University at a
    minimised cost.
    so i started by constrcting a struct. Please i will like to know if i am on the right path.
    Here is my code
    Code:
     
     struct universities   
      {
    	  string name;
    	  int places_left;
    	  double average_grade;
    	  }
    university<universities>university_list;
    	  
           
    
    struct students
          {
          int id;
    	  double my_average_grade;
          universities choice[6];
          universities average_grade;
          }
    student<students>student_list;
          
          
    
    
    struct matching_student{
    	   universities match;
    	   students matchd;
           }matching; 
    
    Thanks a lot in advance
    
    
    
    
        
    
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    You don't say what you want to know. Also, in future, please use a descriptive, searchable subject line. I would suggest that you read the "Before you make a query" thread, then formulate a specific question or questions.
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    just constructing the struct does not mean you are on the right path or not but I don't understand what is the use of the matching struct.
     
  4. jomo

    jomo New Member

    Joined:
    Jun 26, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    The Problem is a miminimisation problem. Students ofa university have six choices to select their prefered universities.
    The universities have limited places and select students according to their grades. The problem is to match as many student as possible at a miminimum cost.
    So i started by constructing a struct.

    Thanks
     
  5. jomo

    jomo New Member

    Joined:
    Jun 26, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    please is my construction okay?

    Thanks
     
  6. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    Construction of what? Your compiler will tell you if you have made syntactical errors, providing that you have enabled all errors and warnings (which you should do). No compiler can tell you if your approach is optimal, or even good. Neither can we, because we can't read your mind. Please think about these things in a rational manner, or hire us to come to your house, sit in your chair, and listen to your lectures. We can probably do faily well, given scanty information, but we have been given none.
     
  7. jomo

    jomo New Member

    Joined:
    Jun 26, 2007
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    The issue in question is out of about 300 students and 50 universities, one should match as many students as possible subject to the constraint of the university.
    please i want to create an array of universities , but i am not sure wheather my code is correct.

    university <universities> university_list;
     
  8. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    Have you tried your code? Why do you think it is either correct or incorrect? Is your compiler bitching with error messages? Do you think your approach is bad? Do you know what you want, and have attempted to achieve that? If so, how has your approach failed you?

    Are you picking up on, at all, what I'm getting at here? If not, you need to go sit behind the barn and watch the cotton grow, while you think. This is a programming forum. We try to answer real questions. There is little chance that we can read your mind or deal with your personal uncertainties.
     

Share This Page