Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; fstream storage; struct student_profile{ char FName[100]; char LName[100]; char reg_year[100]; char course[100]; char id[100]; int no_courses; char course_Name[100]; char course_code[100];

#include
#include
using namespace std;
fstream storage;
struct student_profile{
char FName[100];
char LName[100];
char reg_year[100];
char course[100];
char id[100];
int no_courses;
char course_Name[100];
char course_code[100];
int credit_hour;
int quiz_one;
int quiz_two;
int quiz_three;
int mid;
int assignment;
int lab;
int final_exam;
};
student_profile student;
void function_to_register(){
cout<<" Write First Name of student: ";
cin>>student.FName;
cout<<" Write Last Name of student: ";
cin>>student.LName;
cout<<" Write Registration year: ";
cin>>student.reg_year;
cout<<" Write Course of student: ";
cin>>student.course;
cout<<" Write number of courses that student learns in this semester and register them one by one ";
cout<<" Number of courses: ";
cin>> student.no_courses;
for(int a=1; a<=student.no_courses; a++) {
cout<<" Write course Name: ";
cin>>student.course_Name;
cout<<" Enter grade for quiz one: ";
cin>>student.quiz_one;
cout<<" Enter grade for quiz two: ";
cin>>student.quiz_two;
cout<<" Enter grade for quiz three: ";
cin>>student.quiz_three;
cout<<" Enter midterm grade: ";
cin>>student.mid;
cout<<" Enter assignment grade: ";
cin>>student.assignment;
cout<<" Enter lab grade: ";
cin>>student.lab;
cout<<" Enter final exam grade: ";
cin>>student.final_exam;
storage.open("marklist.txt",ios::app) ;
storage.write((char*)&student,sizeof(student));
storage.close();
}
}
void grade_calculator(int totalMark) {
if(totalMark>=90 && totalMark<=100)
cout<<"A+";
else if(totalMark>=80 && totalMark<90)
cout<<"A";
else if(totalMark>=70 && totalMark<80)
cout<<"B";
else if(totalMark>=60 && totalMark<70)
cout<<"C+";
else if(totalMark>=50 && totalMark<60)
cout<<"D";
else if(totalMark>=0 && totalMark<50)
cout<<"F";
else
cout<<"NG";
}
void seeRegistered() {
storage.open("marklist.txt",ios::app);
storage.close();
storage.open("marklist.txt",ios::in);
storage.read((char*)&student,sizeof(student));
while (storage.eof()==0) {
cout<<" ";
cout<<" Full Name: "<
cout<<" Registration Year: "<
cout<<" Faculty: "<
cout<<" ***************************************************************************** ";
cout<<" ******************************STUDENT MARK LIST****************************** ";
cout<<" ***************************************************************************** ";
cout<<" Subject Quiz1 Quiz2 Quiz3 Mid Assignment Final Total Grade ";
cout<<" _____________________________________________________________________________ ";
for(int t=1; t<=student.no_courses; t++) {
int totalMark;
totalMark= (student.quiz_one+student.quiz_two+student.quiz_three+student.assignment+student.mid+student.final_exam)/6;
cout<<" "<
grade_calculator(totalMark);
cout<
storage.read((char*)&student,sizeof(student));
}
}
storage.close();
}
int main() {
char select;
while(1) {
cout<
cout<
cout<<" ********************************************************* ";
cout<<" * REGISTRATION AND MARK LIST SYSTEM * ";
cout<<" ********************************************************* ";
cout<<" * ";
cout<<" Enter 1 To Register New student ";
cout<<" Enter 2 To Show Registerd Students and Their Grade ";
cout<<" Enter 3 To Search for a student ";
cout<<" Enter 4 To Edit a student record ";
cout<<" Enter 5 To Delete a student record ";
cout<<" Enter 0 To Exit ";
cout<<" : ";
cin>>select;
switch (select) {
case '1':
function_to_register();
cout<<" Student Registered succsesfully ";
break;
case '2':
seeRegistered();
break;
}
}
}
Please fix my code, and please add some features that are related to school student registration

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

Students also viewed these Databases questions

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago