Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Calculate grades using the kinder curve
- // Formula: f(x)=x+a(100-x)
- //
- //
- //
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- #include <cstdlib>
- #include <string>
- using namespace std;
- int main()
- {
- const string DASHESLINE = "________________________________________________";
- ifstream gradesin;
- ofstream gradesout;
- int VTID;
- string name,
- kinder,
- alpha,
- dummy,
- dummy2;
- int WHwQ, // Introducing the weighted values signified by putting "W" in front of the grade
- WT1,
- WT2,
- WFin,
- WP1,
- WP2,
- WP3,
- WP4,
- WP5,
- WP6,
- HwQ, // Introducing values for each part of grades
- T1,
- T2,
- Fin,
- P1,
- P2,
- P3,
- P4,
- P5,
- P6,
- xHwQ,
- xT1,
- xT2,
- xFin,
- xP1,
- xP2,
- xP3,
- xP4,
- xP5,
- xP6,
- x; // grade
- double c, //curved grade
- xc, // percentage curve
- px, // percentage uncurve
- a; // Krider value
- gradesout.open("gradesout.txt");
- gradesout << fixed << setprecision(0) << noshowpoint;
- gradesin.open("gradesin.txt");
- // line skipping
- gradesin.ignore(1500, '\n');
- gradesin.ignore(1500,'\n');
- //read file
- gradesin >> WHwQ >> WT1 >> WT2 >> WFin >> WP1 >> WP2 >> WP3 >> WP4 >> WP5 >> WP6 >> dummy >> dummy2;
- gradesin >> kinder >> alpha >> a;
- gradesin.ignore(1500,'\n');
- gradesin >> VTID >> name >> HwQ >> T1 >> T2 >> Fin >> P1 >> P2 >> P3 >> P4 >> P5 >> P6;
- gradesout << "Dwight Barnette" << '\n' << "Student Score/Curve" << '\n' << '\n' << DASHESLINE << '\n' << "Name" << '\t' << '\t' << "Score" << '\t' << "Curve" << '\t' << '\n' << name << '\t' << px << '\t' << xc << '\n' << '\n' << DASHESLINE; // header for grades out file
- while (gradesin)
- {
- if (WHwQ+WT1+WT2+WFin+WP1+WP2+WP3+WP4+WP5+WP6 != 100)
- {
- cout << "Grade values does equal 100%" << endl;
- gradesout << "Grade value does not equal 100%" << endl;
- return 0;
- }
- else
- {
- xHwQ = HwQ*WHwQ;
- xT1 = T1*WT1;
- xT2 = T2*WT2;
- xFin = Fin*WFin;
- xP1 = P1*WP1;
- xP2 = P2*WP2;
- xP3 = P3*WP3;
- xP4 = P4*WP4;
- xP5 = P5*WP5;
- xP6 = P6*WP6;
- x = xHwQ+xT1+xT2+xFin+xP1+xP2+xP3+xP4+xP5+xP6;
- px = x*(.01);
- c = x+a*(100-x);
- xc = c *(.01);
- }// end else
- }//end while
- gradesin.close();
- gradesout.close();
- return 0;
- }// end of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement