A Students Grading System in C++ Using Structures written by my friend Sir Christian Catilogo that allows us to share on my website. Thank you very much, Sir Christian.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.
Sample Program Output
Program Listing
grades.cpp
#include <iostream>
#include<iomanip>
#include<windows.h>
using namespace std;
struct student
{
char Lname[25], Fname[25],Mname[25],course[25];
int studno,recordno,yearlevel,mquiz[2],mass[2], mattendance,mexam,mproject,mrecitation,
fquiz[2],fass[2],fattendance,fexam,fproject,frecitation;
float mquizgrade=0.0, mquiztotal=0.0, mquizave,mprojectave,mrecitationave,
massgrade=0.0, masstotal=0.0, massave,mattave,mexamave,midtotal=0.0,midave,
fquizgrade=0.0, fquiztotal=0.0, fquizave, fprojectave,frecitationave,
fassgrade=0.0, fasstotal=0.0, fassave,fattave,fexamave,finaltotal=0.0,finalave,
finalgrade;
};
int comparator (const void* p, const void* q)
{
return (((struct student*)p)->finalgrade < ((struct student*)q)->finalgrade);
}
int main()
{
HANDLE color=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(color,15);
char let;
int arr=0,studentno=0;
do{
student stud[50];
qsort(stud, arr, sizeof(struct student), comparator);
SetConsoleTextAttribute(color,14);
cout<<"\n\t\t\t\t\t STUDENT RECORD \n";
cout<<"\t\t\t\t\t ~~MENU~~\n";
SetConsoleTextAttribute(color,11);
cout<<"\n\t\t\t\t Press 1 Create Record \n";
cout<<"\n\t\t\t\t Press 2 Delete Record \n";
cout<<"\n\t\t\t\t Press 3 Update Record \n";
cout<<"\n\t\t\t\t Press 4 Search Record \n";
cout<<"\n\t\t\t\t Press 5 Display Record \n";
cout<<"\n\t\t\t\t Press 6 Display Ranking \n";
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t (Input must be integer)\n";
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t\t\t\t Select Option: ";
int stchek=0;
int sw;
SetConsoleTextAttribute(color,15);
cin>>sw;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again ";
cin.clear();
cin.ignore();
goto repeat;
}
switch (sw)
{
case 1:
aaa:
SetConsoleTextAttribute(color,13);
cout<<"\n\t\t\t Enter the Data of the student to create record "<<endl;
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Record number = ";
int st2;
int st;
SetConsoleTextAttribute(color,15);
cin>>st;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto aaa;
}
for(int j=0;j<=arr;j++)
{
st2=st;
if(st2==stud[j].recordno)
{
stchek=1;
}
}
if(stchek!=1){
stud[arr].recordno=st;
int i=0;
cout<<"\n \t\t The Student no = ";
SetConsoleTextAttribute(color,15);
cout<<"19-0"<<++studentno<<endl;
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter the Last Name = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].Lname;
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter the First Name = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].Fname;
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter the Middle Name = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].Mname;
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter the Course = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].course;
yl:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter the Year Level = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].yearlevel;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto yl;
}
else if(stud[arr].yearlevel>5)
{
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t The maximum Yearlevel is [5] ";
cout<<"\n\t\t Please try it Again \n";
goto yl;
}
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t\t\t\t [Enter Midterm Grade] ";
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Quiz Average Grade = (20%)";
for (int quiz=0; quiz<2; quiz++)
{
a:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Quiz grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].mquiz[quiz];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto a;
}
else if(stud[arr].mquiz[quiz]<50 || stud[arr].mquiz[quiz]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto a;
}
}
for (int quiz=0; quiz<2; quiz++)
{
stud[arr].mquizgrade+=stud[arr].mquiz[quiz];
}
stud[arr].mquiztotal=stud[arr].mquizgrade/2;
stud[arr].mquizave=stud[arr].mquiztotal*.2;
i=0;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Assignment Average Grade = (10%)";
for (int ass=0; ass<2; ass++)
{
b:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Assignment Grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].mass[ass];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto b;
}
else if (stud[arr].mass[ass]<50 || stud[arr].mass[ass]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto b;
}
}
for (int ass=0; ass<2; ass++)
{
stud[arr].massgrade+=stud[arr].mass[ass];
}
stud[arr].masstotal=stud[arr].massgrade/2;
stud[arr].massave=stud[arr].masstotal*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Attendance Average Grade = (10%)";
c:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Attendance Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].mattendance;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto c;
}
else if(stud[arr].mattendance<50 || stud[arr].mattendance>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto c;
}
stud[arr].mattave=stud[arr].mattendance*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Midterm Exam Average Grade = (30%)";
d:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Midterm Exam Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].mexam;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto d;
}
else if (stud[arr].mexam<50 || stud[arr].mexam>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto d;
}
stud[arr].mexamave=stud[arr].mexam*.3;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Project Average Grade = (20%) ";
e:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Project Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].mproject;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto e;
}
else if (stud[arr].mproject<50 || stud[arr].mproject>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto e;
}
stud[arr].mprojectave=stud[arr].mproject*.2;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Recitation Average Grade = (10%) ";
f:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Recitation Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].mrecitation;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto f;
}
else if (stud[arr].mrecitation<50 || stud[arr].mrecitation>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto f;
}
stud[arr].mrecitationave=stud[arr].mrecitation*.1;
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t\t\t\t[Enter Finalterm Grade] ";
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Quiz Average Grade = (20%)";
i=0;
for (int quiz=0; quiz<2; quiz++)
{
aa:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Quiz grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].fquiz[quiz];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto aa;
}
else if(stud[arr].fquiz[quiz]<50 || stud[arr].fquiz[quiz]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto aa;
}
}
for (int quiz=0; quiz<2; quiz++)
{
stud[arr].fquizgrade+=stud[arr].fquiz[quiz];
}
stud[arr].fquiztotal=stud[arr].fquizgrade/2;
stud[arr].fquizave=stud[arr].fquiztotal*.2;
i=0;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Assignment Average Grade = (10%)";
for (int ass=0; ass<2; ass++)
{
bb:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Assignment Grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].fass[ass];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto bb;
}
else if (stud[arr].fass[ass]<50 || stud[arr].fass[ass]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto bb;
}
}
for (int ass=0; ass<2; ass++)
{
stud[arr].fassgrade+=stud[arr].fass[ass];
}
stud[arr].fasstotal=stud[arr].fassgrade/2;
stud[arr].fassave=stud[arr].fasstotal*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Attendance Average Grade = (10%)";
cc:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Attendance Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].fattendance;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto cc;
}
else if(stud[arr].fattendance<50 || stud[arr].fattendance>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto cc;
}
stud[arr].fattave=stud[arr].fattendance*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Midterm Exam Average Grade = (30%)";
dd:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Midterm Exam Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].fexam;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto dd;
}
else if (stud[arr].fexam<50 || stud[arr].fexam>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto dd;
}
stud[arr].fexamave=stud[arr].fexam*.3;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Project Average Grade = (20%) ";
ee:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Project Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].fproject;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto ee;
}
else if (stud[arr].fproject<50 || stud[arr].fproject>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto ee;
}
stud[arr].fprojectave=stud[arr].fproject*.2;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Recitation Average Grade = (10%) ";
ff:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Recitation Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[arr].frecitation;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto ff;
}
else if (stud[arr].frecitation<50 || stud[arr].frecitation>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto ff;
}
stud[arr].frecitationave=stud[arr].frecitation*.1;
stud[arr].midtotal=stud[arr].midtotal+stud[arr].mquizave+stud[arr].massave+stud[arr].mattave+
stud[arr].mexamave+stud[arr].mprojectave+stud[arr].mrecitationave;
stud[arr].finaltotal=stud[arr].finaltotal+stud[arr].fquizave+stud[arr].fassave+stud[arr].fattave+
stud[arr].fexamave+stud[arr].fprojectave+stud[arr].frecitationave;
stud[arr].midave=stud[arr].midtotal*.50;
stud[arr].finalave=stud[arr].finaltotal*.50;
stud[arr].finalgrade=stud[arr].midave+stud[arr].finalave;
stud[arr].studno=studentno;
arr=arr+1;
}
else
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t\t This Record Number already have record \n";
}
break;
case 2:
bbb:
SetConsoleTextAttribute(color,13);
cout<<"\n\t\t Enter the Record number of the student record To Delete : ";
SetConsoleTextAttribute(color,15);
cin>>st;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto bbb;
}
for(int j=0;j<=arr;j++)
{
st2=st;
if(st2==stud[j].recordno)
{
stud[j].recordno='d';
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t\t [Record Deleted]";
SetConsoleTextAttribute(color,15);
}
}
break;
case 3:
ccc:
SetConsoleTextAttribute(color,13);
cout<<"\n\t\t\t Enter the Record no of the student To Update : ";
SetConsoleTextAttribute(color,15);
cin>>st;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto ccc;
}
for(int j=0;j<=arr;j++)
{
st2=st;
if(st2==stud[j].recordno)
{
int i=0;
cout<<"\n\t\t Recordno = ";
cout<<stud[j].recordno;
cout<<"\n\t\t Student no = 19-0"<<stud[j].studno;
cout<<"\n \t\t Last Name = ";
cout<<stud[j].Lname;
cout<<"\n \t\t First Name = ";
cout<<stud[j].Fname;
cout<<"\n \t\t Middle Name = ";
cout<<stud[j].Mname;
cout<<"\n \t\t Course = ";
cout<<stud[j].course;
cout<<"\n \t\t Year Level = ";
cout<<stud[j].yearlevel;
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t\t ReEnter Data ";
SetConsoleTextAttribute(color,11);
cout<<"\n\t\t Enter the Last Name = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].Lname;
SetConsoleTextAttribute(color,11);
cout<<"\n\t\t Enter the First Name = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].Fname;
SetConsoleTextAttribute(color,11);
cout<<"\n\t\t Enter the Middle Name = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].Mname;
SetConsoleTextAttribute(color,11);
cout<<"\n\t\t Enter the Course = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].course;
SetConsoleTextAttribute(color,11);
yls:
cout<<"\n\t\t Enter the Year Level = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].yearlevel;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto yls;
}
else if(stud[arr].yearlevel>5)
{
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t The maximum Yearlevel is [5] ";
cout<<"\n\t\t Please try it Again \n";
goto yls;
}
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t\t [Enter Midterm Grade] ";
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Quiz Average Grade = (20%)";
for (int quiz=0; quiz<2; quiz++)
{
g:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Quiz grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].mquiz[quiz];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto g;
}
else if(stud[j].mquiz[quiz]<50 || stud[j].mquiz[quiz]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto g;
}
}
for (int quiz=0; quiz<2; quiz++)
{
stud[j].mquizgrade+=stud[j].mquiz[quiz];
}
stud[j].mquiztotal=stud[j].mquizgrade/2;
stud[j].mquizave=stud[j].mquiztotal*.2;
i=0;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Assignment Average Grade = (10%)";
for (int ass=0; ass<2; ass++)
{
h:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Assignment Grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].mass[ass];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto h;
}
else if (stud[j].mass[ass]<50 || stud[j].mass[ass]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto h;
}
}
for (int ass=0; ass<2; ass++)
{
stud[j].massgrade+=stud[j].mass[ass];
}
stud[j].masstotal=stud[j].massgrade/2;
stud[j].massave=stud[j].masstotal*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Attendance Average Grade = (10%)";
i:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Attendance Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].mattendance;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto i;
}
else if(stud[j].mattendance<50 || stud[j].mattendance>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto i;
}
stud[j].mattave=stud[j].mattendance*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Midterm Exam Average Grade = (30%)";
j:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Midterm Exam Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].mexam;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto j;
}
else if (stud[j].mexam<50 || stud[j].mexam>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto j;
}
stud[j].mexamave=stud[j].mexam*.3;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Project Average Grade = (20%) ";
k:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Project Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].mproject;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto k;
}
else if (stud[j].mproject<50 || stud[j].mproject>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto k;
}
stud[j].mprojectave=stud[j].mproject*.2;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Recitation Average Grade = (10%) ";
l:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Recitation Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].mrecitation;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto l;
}
else if (stud[j].mrecitation<50 || stud[j].mrecitation>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto l;
}
stud[j].mrecitationave=stud[j].mrecitation*.1;
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t\t\t\t [Enter Finalterm Grade] ";
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Quiz Average Grade = (20%)";
i=0;
for (int quiz=0; quiz<2; quiz++)
{
gg:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Quiz grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].fquiz[quiz];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto gg;
}
else if(stud[j].fquiz[quiz]<50 || stud[j].fquiz[quiz]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto gg;
}
}
for (int quiz=0; quiz<2; quiz++)
{
stud[j].fquizgrade+=stud[j].fquiz[quiz];
}
stud[j].fquiztotal=stud[j].fquizgrade/2;
stud[j].fquizave=stud[j].fquiztotal*.2;
i=0;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Assignment Average Grade = (10%)";
for (int ass=0; ass<2; ass++)
{
hh:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Assignment Grade no "<<++i<<" = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].fass[ass];
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
i=i-1;
goto hh;
}
else if (stud[j].fass[ass]<50 || stud[j].fass[ass]>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
i=i-1;
goto hh;
}
}
for (int ass=0; ass<2; ass++)
{
stud[j].fassgrade+=stud[j].fass[ass];
}
stud[j].fasstotal=stud[j].fassgrade/2;
stud[j].fassave=stud[j].fasstotal*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Attendance Average Grade = (10%)";
ii:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Attendance Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].fattendance;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto ii;
}
else if(stud[j].fattendance<50 || stud[j].fattendance>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto ii;
}
stud[j].fattave=stud[j].fattendance*.1;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Midterm Exam Average Grade = (30%)";
jj:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Midterm Exam Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].fexam;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto jj;
}
else if (stud[j].fexam<50 || stud[j].fexam>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto jj;
}
stud[j].fexamave=stud[j].fexam*.3;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Project Average Grade = (20%) ";
kk:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Project Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].fproject;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto kk;
}
else if (stud[j].fproject<50 || stud[j].fproject>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto kk;
}
stud[j].fprojectave=stud[j].fproject*.2;
SetConsoleTextAttribute(color,14);
cout<<"\n \t\t Recitation Average Grade = (10%) ";
ll:
SetConsoleTextAttribute(color,11);
cout<<"\n \t\t Enter Recitation Grade = ";
SetConsoleTextAttribute(color,15);
cin>>stud[j].frecitation;
SetConsoleTextAttribute(color,11);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto ll;
}
else if (stud[j].frecitation<50 || stud[j].frecitation>100)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!!";
cout<<"\n \t\t Input Shouldn't be Lessthan 50 or Greaterthan 100 ";
cout<<"\n \t\t Please Try it Again \n";
goto ll;
}
stud[j].frecitationave=stud[j].frecitation*.1;
stud[j].frecitationave=stud[j].frecitation*.1;
stud[j].midtotal=stud[j].midtotal+stud[j].mquizave+stud[j].massave+stud[j].mattave+
stud[j].mexamave+stud[j].mprojectave+stud[j].mrecitationave;
stud[j].finaltotal=stud[j].finaltotal+stud[j].fquizave+stud[j].fassave+stud[j].fattave+
stud[j].fexamave+stud[j].fprojectave+stud[j].frecitationave;
stud[j].midave=stud[j].midtotal*.50;
stud[j].finalave=stud[j].finaltotal*.50;
stud[j].finalgrade=stud[j].midave+stud[j].finalave;
}
}studentno-=1;
break;
case 4:
ddd:
SetConsoleTextAttribute(color,13);
cout<<"\n \t\t\t Enter the Record number To Search : ";
SetConsoleTextAttribute(color,15);
cin>>st;
SetConsoleTextAttribute(color,15);
if(!cin)
{
SetConsoleTextAttribute(color,12);
cout<<"\n \t\t Invalid Input !!! ";
cout<<"\n \t\t Please Try it Again \n";
cin.clear();
cin.ignore();
goto ddd;
}
for(int j=0;j<=arr;j++)
{
st2=st;
if(st2==stud[j].recordno)
{
cout<<fixed<<showpoint;
cout<<setprecision(2);
SetConsoleTextAttribute(color,15);
cout<<"\n\t\tRecordno = ";
cout<<stud[j].recordno;
cout<<"\n\t\tStudent no = 19-0"<<stud[j].studno;
cout<<"\n\t\tLast Name = ";
cout<<stud[j].Lname;
cout<<"\n\t\tFirst Name = ";
cout<<stud[j].Fname;
cout<<"\n\t\tMiddle Name = ";
cout<<stud[j].Mname;
cout<<"\n\t\tCourse = ";
cout<<stud[j].course;
cout<<"\n\t\tYear Level = ";
cout<<stud[j].yearlevel;
SetConsoleTextAttribute(color,14);
cout<<"\n\t\t\t\t [Midterm Grade Record]";
SetConsoleTextAttribute(color,15);
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t|\t Catergory"<<"\t |\t Average \t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t| Quiz Average\t |\t "<<stud[j].mquizave<<"%\t |";
cout<<"\n\t\t\t| Assignment Average\t |\t "<<stud[j].massave<<"%\t |";
cout<<"\n\t\t\t| Attendance Average\t |\t "<<stud[j].mattave<<"%\t |";
cout<<"\n\t\t\t| Midterm Exam Average |\t "<<stud[j].mexamave<<"%\t |";
cout<<"\n\t\t\t| Project Average\t |\t "<<stud[j].mprojectave<<"%\t |";
cout<<"\n\t\t\t| Recitation Average\t |\t "<<stud[j].mrecitationave<<"%\t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
SetConsoleTextAttribute(color,14);
cout<<"\n\t\t\t\t [Finalterm Grade Record]";
SetConsoleTextAttribute(color,15);
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t|\t Catergory"<<"\t |\t Average \t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t| Quiz Average\t |\t "<<stud[j].fquizave<<"%\t |";
cout<<"\n\t\t\t| Assignment Average\t |\t "<<stud[j].fassave<<"%\t |";
cout<<"\n\t\t\t| Attendance Average\t |\t "<<stud[j].fattave<<"%\t |";
cout<<"\n\t\t\t| Midterm Exam Average |\t "<<stud[j].fexamave<<"%\t |";
cout<<"\n\t\t\t| Project Average\t |\t "<<stud[j].fprojectave<<"%\t |";
cout<<"\n\t\t\t| Recitation Average\t |\t "<<stud[j].frecitationave<<"%\t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t\t\t Final Average = "<<stud[j].finalgrade<<"%";
SetConsoleTextAttribute(color,14);
if (stud[j].finalgrade>=98 && stud[j].finalgrade<=100)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.00";
}
else if (stud[j].finalgrade>=95 && stud[j].finalgrade<=97)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.25";
}
else if (stud[j].finalgrade>=92 && stud[j].finalgrade<=94)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.50";
}
else if (stud[j].finalgrade>=89 && stud[j].finalgrade<=91)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.75";
}
else if (stud[j].finalgrade>=86 && stud[j].finalgrade<=88)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.00";
}
else if (stud[j].finalgrade>=83 && stud[j].finalgrade<=85)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.25";
}
else if (stud[j].finalgrade>=80 && stud[j].finalgrade<=82)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.25";
}
else if (stud[j].finalgrade>=78 && stud[j].finalgrade<=79)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.50";
}
else if (stud[j].finalgrade>=76 && stud[j].finalgrade<=77)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.75";
}
else if (stud[j].finalgrade>=75)
{
cout<<"\n\t\t\t\t\t PASSED "<<"3.00";
}
else
{
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t\t FAILED "<<"5.00";
}
SetConsoleTextAttribute(color,15);
}}studentno-=1;
break;
case 5:
for(int k=0;k<arr;k++)
{
if (stud[k].recordno!='d')
{
cout<<fixed<<showpoint;
cout<<setprecision(2);
SetConsoleTextAttribute(color,15);
cout<<"\n\t\tRecordno: "<<stud[k].recordno;
cout<<"\n\t\tStudent no = 19-0"<<stud[k].studno;
cout<<"\n\t\tLast Name: "<<stud[k].Lname;
cout<<"\n\t\tFirst Name: "<<stud[k].Fname;
cout<<"\n\t\tMiddle Name: "<<stud[k].Mname;
cout<<"\n\t\tCourse: "<<stud[k].course;
cout<<"\n\t\tYear Level: "<<stud[k].yearlevel;
SetConsoleTextAttribute(color,14);
cout<<"\n\t\t\t\t [Midterm Grade Record]";
SetConsoleTextAttribute(color,15);
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t|\t Catergory"<<"\t |\t Average \t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t| Quiz Average\t |\t "<<stud[k].mquizave<<"%\t |";
cout<<"\n\t\t\t| Assignment Average\t |\t "<<stud[k].massave<<"%\t |";
cout<<"\n\t\t\t| Attendance Average\t |\t "<<stud[k].mattave<<"%\t |";
cout<<"\n\t\t\t| Midterm Exam Average |\t "<<stud[k].mexamave<<"%\t |";
cout<<"\n\t\t\t| Project Average\t |\t "<<stud[k].mprojectave<<"%\t |";
cout<<"\n\t\t\t| Recitation Average\t |\t "<<stud[k].mrecitationave<<"%\t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
SetConsoleTextAttribute(color,14);
cout<<"\n\t\t\t\t [Finalterm Grade Record]";
SetConsoleTextAttribute(color,15);
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t|\t Catergory"<<"\t |\t Average \t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t| Quiz Average\t |\t "<<stud[k].fquizave<<"%\t |";
cout<<"\n\t\t\t| Assignment Average\t |\t "<<stud[k].fassave<<"%\t |";
cout<<"\n\t\t\t| Attendance Average\t |\t "<<stud[k].fattave<<"%\t |";
cout<<"\n\t\t\t| Midterm Exam Average |\t "<<stud[k].fexamave<<"%\t |";
cout<<"\n\t\t\t| Project Average\t |\t "<<stud[k].fprojectave<<"%\t |";
cout<<"\n\t\t\t| Recitation Average\t |\t "<<stud[k].frecitationave<<"%\t |";
cout<<"\n\t\t\t+------------------------+------------------------+";
cout<<"\n\t\t\t\t\t Final Average = "<<stud[k].finalgrade<<"%";
SetConsoleTextAttribute(color,14);
if (stud[k].finalgrade>=98 && stud[k].finalgrade<=100)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.00";
}
else if (stud[k].finalgrade>=95 && stud[k].finalgrade<=97)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.25";
}
else if (stud[k].finalgrade>=92 && stud[k].finalgrade<=94)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.50";
}
else if (stud[k].finalgrade>=89 && stud[k].finalgrade<=91)
{
cout<<"\n\t\t\t\t\t PASSED "<<"1.75";
}
else if (stud[k].finalgrade>=86 && stud[k].finalgrade<=88)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.00";
}
else if (stud[k].finalgrade>=83 && stud[k].finalgrade<=85)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.25";
}
else if (stud[k].finalgrade>=80 && stud[k].finalgrade<=82)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.25";
}
else if (stud[k].finalgrade>=78 && stud[k].finalgrade<=79)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.50";
}
else if (stud[k].finalgrade>=76 && stud[k].finalgrade<=77)
{
cout<<"\n\t\t\t\t\t PASSED "<<"2.75";
}
else if (stud[k].finalgrade>=75)
{
cout<<"\n\t\t\t\t\t PASSED "<<"3.00";
}
else
{
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t\t FAILED "<<"5.00";
}
SetConsoleTextAttribute(color,15);
cout<<"\n\t_________________________________________________________________________________\n";
}
}
break;
case 6:
int rank;
cout<<fixed<<showpoint;
cout<<setprecision(2);
SetConsoleTextAttribute(color,15);
cout<<"\t +------+-----------+------------------------------------+---------------+----------+\n";
cout<<setw(15)<<"Rank";
cout<<setw(12)<<"StudentNo";
cout<<setw(22)<<"Name";
cout<<setw(31)<<"Course & Year";
cout<<setw(9)<<"Grade"<<endl;
cout<<"\t +------+-----------+------------------------------------+---------------+----------+\n";
for (int k=0; k<arr; k++)
{
rank=k+1;
if(rank<=10)
{
cout<<right<<setw(13)<<rank;
cout<<right<<setw(11)<<"19-0"<<stud[k].studno;
cout<<right<<setw(18)<<stud[k].Fname;
cout<<right<<setw(10)<<stud[k].Mname;
cout<<right<<setw(10)<<stud[k].Lname;
cout<<right<<setw(12)<<stud[k].course<<"-"<<stud[k].yearlevel;
cout<<right<<setw(12)<<stud[k].finalgrade<<"%"<<endl;
}
}
cout<<"\t +------+-----------+------------------------------------+---------------+----------+\n";
break;
default:
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t Wrong option Selected ";
}
repeat:
SetConsoleTextAttribute(color,15);
cout<<"\n \n \t\t Do You want to Continue Again [Y/N] = ";
cin>>let;
}
while(let=='y' || let=='Y');
if(let=='n' || let=='N')
{
SetConsoleTextAttribute(color,12);
cout<<"\n\t\t\t\t [End of the Program]";
SetConsoleTextAttribute(color,15);
}
return 0;
}