A Program that Read and Store Student file records (Grading System)

hello everyone...
I have instructed to create a Grading system that covers following grading period and computation:
I'm trouble making the sum of the Prelim 30%, Midterm 30%, Final 40% average to get the total average 100%.

#include<iostream>
#include<fstream>
#include<stdio.h>
#include<conio.h>
#include<sstream>
#include<iomanip>

using namespace std;

int AppendFile();
int BrowseFile();
int FindRecord();
int ViewProfile();
int Start();
int Back();
int Prelim();
int Midterm();
int Final();
int Subfind();



int main()
{
system ("color 5F");
system ("cls");
cout << "\t==============================================================" << endl;
cout << "\t| NORTHERN COLLEGE OF INFORMATION TECHNOLOGY AND COMPUTING |" << endl;
cout << "\t==============================================================" << endl << endl;
Start();

getch();
}
int Start()
{
int choice;
back:
cout<<" NCITC Grade Portal :"<<endl;
cout<<"\t[1] Append Record "<<endl;
cout<<"\t[2] Browse all file contents "<<endl;
cout<<"\t[3] Find a record "<<endl;
cout<<"\t[4] Exit "<<endl;
cout<<"\t[5] About \n"<<endl;
cin>>choice;

switch (choice)
{
case 1:
system("cls");
AppendFile();
Back();
break;
case 2:
system("cls");
BrowseFile();
Back();
break;
case 3:
system("cls");
FindRecord();
Back();
break;
case 4:
system("cls");
cout<<" Thank you . . .";
break;
case 5:
system("cls");
ViewProfile();
break;
default:
cout<<"Invalid Entry ! . . . Try Again . . .\n";
system("cls");
break;
goto back;
system("cls");
}
}
int AppendFile()
{
string id , firstname , lastname;
ofstream myfile;
myfile.open ("NCITC.txt");
cout<<" Student ID : ";
cin>> id;
cout<<"\n Student Name : ";
cin>>firstname>>lastname;
Prelim();
Midterm();
Final();

myfile<< id<< ", " << firstname<< " " << lastname << " , " << endl;
myfile<< fixed;

}
int Prelim()
{

float marks[3][4]={0};

for(int prelim=0 ;prelim < 1 ; prelim++)
{
cout<<"\n Enter the marks obtained by student in [Prelim] :"<<endl;
cout<<"\n\t Attendance/Assignment 10% (No. of Presence in 30 days)= ";
cin>>marks[prelim][0];

cout<<"\n\t SW/Labe Exercises 20% (total of 100)= ";
cin>>marks[prelim][1];

cout<<"\n\t Quizzes 30% (total of 150)= ";
cin>>marks[prelim][2];

cout<<"\n\t Exam 40% (total of 60)= ";
cin>>marks[prelim][3];
cout<<endl;
cout<<" ================================* RESULT *==============================\n\n";
cout<<" Attd/Assign 10% =|= SW/Labe Exercises 20% =|= Quizzes 30% =|= Exam 40% \n\n";
for(int prelim_1=0;prelim_1<10;prelim_1++)
{
cout<<setw(11)<<(prelim_1=(marks[prelim][0] / 30 *.10)*100)<<"%";
cout<<setw(19)<<(prelim_1=(marks[prelim][1] / 100 *.20)*100)<<"%";
cout<<setw(22)<<(prelim_1=(marks[prelim][2] / 150 *.30)*100)<<"%";
cout<<setw(15)<<(prelim_1=(marks[prelim][3] / 60 *.40)*100)<<"%";
cout<<endl<<endl<<endl;
}

float sum=0;
for(int count=0;count<4;count++)

sum=(sum+marks[prelim][count]);

cout <<"PRELIM: "<<((sum/340*.30)*100)<<"%";
cout<<endl<<endl;

}
}
int Midterm()
{
float marks[3][4]={0};

for(int midterm=0 ;midterm < 1 ; midterm++)
{
cout<<"\n Enter the marks obtained by student in [Midterm] :"<<endl;
cout<<"\n\t Attendance/Assignment 10% (No. of Presence in 30 days)= ";
cin>>marks[midterm][0];

cout<<"\n\t SW/Labe Exercises 20% (total of 100)= ";
cin>>marks[midterm][1];

cout<<"\n\t Quizzes 30% (total of 150)= ";
cin>>marks[midterm][2];

cout<<"\n\t Exam 40% (total of 60)= ";
cin>>marks[midterm][3];
cout<<endl;
cout<<" ================================* RESULT *==============================\n\n";
cout<<" Attd/Assign 10% =|= SW/Labe Exercises 20% =|= Quizzes 30% =|= Exam 40% \n\n";
for(int midterm_1=0;midterm_1<10;midterm_1++)
{
cout<<setw(11)<<(midterm_1=(marks[midterm][0] / 30 *.10)*100)<<"%";
cout<<setw(19)<<(midterm_1=(marks[midterm][1] / 100 *.20)*100)<<"%";
cout<<setw(22)<<(midterm_1=(marks[midterm][2] / 150 *.30)*100)<<"%";
cout<<setw(15)<<(midterm_1=(marks[midterm][3] / 60 *.40)*100)<<"%";
cout<<endl<<endl<<endl;
}

float sum2=0;
for(int count2=0;count2<4;count2++)

sum2=(sum2+marks[midterm][count2]);

cout<<"MIDTERM: "<<((sum2 / 340 *.30)*100)<<"%";
cout<<endl<<endl;

}
}
int Final()
{
float marks[3][4]={0};

for(int final=0 ;final < 1 ; final++)
{
cout<<"\n Enter the marks obtained by student in [Final] :"<<endl;
cout<<"\n\t Attendance/Assignment 10% (No. of Presence in 30 days)= ";
cin>>marks[final][0];

cout<<"\n\t SW/Labe Exercises 20% (total of 100)= ";
cin>>marks[final][1];

cout<<"\n\t Quizzes 30% (total of 150)= ";
cin>>marks[final][2];

cout<<"\n\t Exam 40% (total of 60)= ";
cin>>marks[final][3];
cout<<endl;
cout<<" ================================* RESULT *==============================\n\n";
cout<<" Attd/Assign 10% =|= SW/Labe Exercises 20% =|= Quizzes 30% =|= Exam 40% \n\n";
for(int final_1=0;final_1<10;final_1++)
{
cout<<setw(11)<<(final_1=(marks[final][0] / 30 *.10)*100)<<"%";
cout<<setw(19)<<(final_1=(marks[final][1] / 100 *.20)*100)<<"%";
cout<<setw(22)<<(final_1=(marks[final][2] / 150 *.30)*100)<<"%";
cout<<setw(15)<<(final_1=(marks[final][3] / 60 *.40)*100)<<"%";
cout<<endl<<endl<<endl;
}

float sum3=0;
for(int count3=0;count3<4;count3++)

sum3=(sum3+marks[final][count3]);

cout<<"FINAL: "<<((sum3 / 340 *.40)*100)<<"%";
cout<<endl<<endl;

}

}
Last edited on
Topic archived. No new replies allowed.