int main(){ int arr[] = {10,3,-5,8,2,5,-12,3,13,4,0,0,INT_MAX,INT_MIN}; Sorting srt; srt.sort(arr, sizeof(arr)/sizeof(int)); for (unsigned int i = 0; i < sizeof(arr)/sizeof(int); ++i){ cout << arr[i] << " "; } cout << endl; return 0; }
void Assign::assign(vector <Student*> Courses[NUM_COURSES], vector <Student*> TA, vector <int> TAships){ vector <Student*> assignment[NUM_COURSES]; Sorting sort; unsigned int i,j; // add heuristics, ex: karl's note about constrained TAs // final resort while (!constraint_course(assignment,TAships)/*||!constraint_guarantee(Courses)*/){ for (i=0;i<NUM_COURSES;i++){ //cout << assignment[i].size() << " " << TAships[i] << endl; if(assignment[i].size()<(unsigned)TAships[i]){ assignment[i].push_back(Courses[i][0]); //cout << "Added "<< assignment[i][assignment[i].size()-1]->firstName << " " << assignment[i][assignment[i].size()-1]->TAhoursOwed << " to course " << i << endl; TA[Courses[i][0]->id]->TAhoursOwed -= 54; TA[Courses[i][0]->id]->TAshipsWanted -= 54; TA[Courses[i][0]->id]->TAshipsWanted -= 54; TA[Courses[i][0]->id]->minWilling -= 54; TA[Courses[i][0]->id]->maxWilling -= 54; TA[Courses[i][0]->id]->minTA -= 54; TA[Courses[i][0]->id]->maxTA -= 54; sort.sort(TA,Courses); } /*else if (constraint_course(assignment,TAships)&&!constraint_guarantee(Courses)){ assignment[i].push_back(Courses[i][0]); cout << "Added "<< assignment[i][assignment[i].size()-1]->firstName << "to course " << i << endl; TA[Courses[i][0]->id]->TAhoursOwed -= 54; TA[Courses[i][0]->id]->TAshipsWanted -= 54; TA[Courses[i][0]->id]->TAshipsWanted -= 54; TA[Courses[i][0]->id]->minWilling -= 54; TA[Courses[i][0]->id]->maxWilling -= 54; TA[Courses[i][0]->id]->minTA -= 54; TA[Courses[i][0]->id]->maxTA -= 54; sort.sort(TA,Courses); } */ } } //print assignment for(i=0;i<NUM_COURSES;i++){ cout << "course " << i; for (j=0;j<assignment[i].size();j++){ cout << " " << assignment[i][j]->firstName; } cout << endl; } //return assignment; need to find out how to return vector <student*> assignment[NUM_COURSES] }