static int calctypeenlarge(int tp1, int tp2) { tp1 = calctype(tp1, tp2); switch (tp1) { case TYPE_bte: return TYPE_sht; case TYPE_sht: return TYPE_int; case TYPE_int: return TYPE_lng; #ifdef HAVE_HGE case TYPE_lng: return TYPE_hge; #endif case TYPE_flt: return TYPE_dbl; default: /* we shouldn't get here */ return tp1; } }
float gradecalc(std::vector<assgn> & test,int studnum) // Note this code can be expanded to take up 90 more lines. { /* Calculate grade in percentage */ // note the types and their weightage. float project = calctype(test,"Project",projweightage,studnum); float HW = calctype(test,"HW",hwweightage,studnum); float Test = calctype(test,"Test",testweightage,studnum); // note this Test is different from the test vector. float quiz = calctype(test,"Quiz",quizweightage,studnum); float classwork = calctype(test,"Classwork",classworkweightage,studnum); float atten = calctype(test,"Atten",attenweightage,studnum); float grade = project + HW + Test + quiz + classwork + atten; grade = (grade/outof)*100; outof=100; // Reset out of so it doesn't affect next student. return grade; }