Print Students marks-sheet using C++

In the program, 5 subject names and subject marks have been stored using the array. But, if there is no practical marks in any subject, in such a case, enter 0 value instead of practical marks. In this way, this program can print the marksheet of almost all the students who have 5 subjects whether practical subject or not. Before starting the program, the header files and their functions used in the program are described below. In the program,The following header file types and their function are used.
#include<iostream.h>
#include<fstream.h>
#include <stdio.h> //rename(),remove()
#include <stdlib.h> //itoa(),atoi()
#include<conio.h>
#include<dos.h> //getdate()
#include<iomanip.h> // setwidth(),setiosflags()
#include<string.h> //strupr(),strcpy(),strcmp() strcat()

 class student
 {
   int marks[5],marks2[5],total_marks,pr;
   char r_no[10],stu_name[20],dob[20],f_name[20],m_name[20];
   typedef char subj[100];
   subj name[20]; // store subject name into name[] array

  public:
   void get_record(void); // take personal and subject detail from user
   void printing(); // print marksheet
   void grade(int,int); // store subject grade
//convert digit into character form//
    void get_total(int); //
    void one(char[],int); //
    void two(int); //
    void three(char[],int,int); //
    void process(char[],int,int); //
////////////////////////
};
subject-name is written from the first-array name[] while subject-marks are written from the second-array marks[],
cout<<"Student subject Detail\nIf prectical subject not then enter 0\n";
 for(int i=0;i<5;i++)
 {
   cout<<"Enter "<<i+1<<" subject name: ";
   gets(name[i]); // store subject
 }
 cout<<endl;
 for(int j=0;j<5;j++)
 {
    cout<<"\nEnter "<<j+1<<" subject marks : ";cin>>marks[j];
    cout<<"And prectical marks : ";cin>>marks2[j];
    total_marks=total_marks+marks[j]+marks2[j]; // calculate total marks of subject
 }
 pr = total_marks/5; // variable pr store percantage
and while-loop is used to write the subject-data in the file which will execute 5-times (according to the subject) and write detail of a subject in each increment.
int subject=0;
while(subject<5) // loop execute 5 time because of 5 subject
{
  fout<<"\n\t| ";
  fout.width(25);
  fout<<setiosflags(ios::left);
  fout<<strupr(name[subject]);// convert subject name into uppper case than write into file

  fout.width(6);
  fout<<setiosflags(ios::right);
  fout<<"|";
  fout.width(6);
  fout<<setiosflags(ios::right);
  fout<<marks[subject]; //print subject marks

  fout.width(5);
  fout<<setiosflags(ios::right);
  fout<<"|";
  fout.width(7);
  fout<<setiosflags(ios::right);
  if(marks2[subject]==0) // check subject is prectical or not
     fout<<"_";
  else
     fout<<marks2[subject];

  fout.width(5);
  fout<<setiosflags(ios::right);
  fout<<"|";
  fout.width(6);
  fout<<setiosflags(ios::right);
  fout<<marks[subject]+marks2[subject]; // print total of theory and prectical

  fout.width(4);
  fout<<setiosflags(ios::right);
  fout<<"|";
  fout<<" ";
  fout.width(13);
  fout<<setiosflags(ios::left);

  get_total(marks[subject]+marks2[subject]); // convert total into character form
  char ch[50];
  ifstream f0("char");
  while(!f0.eof()) {
     f0.getline(ch,50);
  } f0.close();
  strupr(ch); // convert string into upper case
  fout<<ch; // write total as character form into file
  remove("char"); // now remove char file after use

  fout<<" ";
  fout.width(3);
  fout<<setiosflags(ios::left);
  fout<<"|";

  grade(marks[subject],marks2[subject]);
  char g1[10];
  ifstream o1("grade");//open grade file to calculate grade for subject
  while(!o1.eof()) {
     o1.getline(g1,10);
    }o1.close();
  fout<<g1; // write grade into subject

  fout.width(4);
  fout<<setiosflags(ios::right);
  fout<<"|";

  if(subject==0)// represent row 
   {
     fout.width(8);
     fout<<setiosflags(ios::right);
     fout<<total_marks<<" |"; // print total subject marks accessing from get_record() function
   }

  if(subject==1)
  {
     fout.width(8);
     fout<<setiosflags(ios::right);
     if(marks[subject]<33||marks2[subject]) // check sudent passed or not
       fout<<"FAIL";
     else
       fout<<"PASSED";
     fout.width(4);
     fout<<setiosflags(ios::right);
     fout<<"|";
   }

  if(subject==2)
  {
     fout.width(7);
     fout<<setiosflags(ios::right);
     fout<<pr<<"%";
     fout.width(4);
     fout<<setiosflags(ios::right);
     fout<<"|";
  }
  if(subject==3)
  {
// write division into file
     fout.width(8);
     fout<<setiosflags(ios::right);
     if(pr>=60)
        fout<<"FIRST";
     else if(pr>=45&&pr<60)
        fout<<"SECOND";
     else if(pr<33)
        fout<<"THIRD";
     fout.width(4);
     fout<<setiosflags(ios::right);
     fout<<"|";
  }

  if(subject==4)
  {
     fout<<" DIV. |";
  }
The data entered by the user is in any form (lowercase or uppercase), the data in the file will be write in uppercase itself (because of strupr () function) as shown in the output. The marksheet of two different classes (12th and IT courses) has been printed by the program.
OUTPUT:-

1st execution:-

 Student personal detail
Enter Class or Level   : 12th
 Enter Student roll no  : 1002
 Enter Student Name   : anand bisht	
 Enter Date of Birth     : 30/06/1996
 Enter Father Name     : kishan singh
 Enter Mother Name    : kamla devi
 
Student subject Detail
If prectical subject not then enter 0
Enter 1 subject name: hindi
Enter 2 subject name: english
Enter 3 subject name: biology
Enter 4 subject name: physics
Enter 5 subject name: chemistry

Enter 1 subject marks: 70
And Practical Marks  : 0
Enter 2 subject marks: 28
And Practical Marks  : 0
Enter 3 subject marks: 50
And Practical Marks  : 28
Enter 4 subject marks: 39
And Practical Marks  : 20
Enter 5 subject marks: 46
And Practical Marks  : 26
anand-marksheet-in-cpp

2nd execution:-Different detail(information technology) entering same way as above and but is,

program will work as fallows where we print a different student marksheet,

download complete program and execute yourself,