Friday, 14 February 2014

RESULT MANAGEMENT SYSTEM

 //A program by Lakshay


#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
struct stud{
    int roll;
    char name[20],address[20],fname[20],grade;
    int m[5];
    int total;
    int perc;
    }student[5],child;

struct subj{
  char name[10];};
  int average=0;


  void names(stud student[5])
  {  cout<<"Enter The Name of 5 Students\n";
   for (int i=0;i<5;i++)
    {
    gets(student[i].name);
    cout<<endl;
    student[i].name[0]=toupper(student[i].name[0]);
    }

  }


 void address(stud student[5])
 { cout<<"Enter the Address of the Respective Students\n";
   for (int i=0;i<5;i++)
    { cout<<student[i].name<<endl;
      gets(student[i].address);
      cout<<endl;
    }
  }

 //for input of father's name
 void fname(stud student[5])
  {
   cout<<"Enter the Father's name of the following students -\n";
   for (int i=0;i<5;i++)
     {
       cout<<student[i].name<<endl;
       gets(student[i].fname);
       cout<<endl;
       student[i].fname[0]=toupper(student[i].fname[0]);
       for(int j=0;j!='\0';j++)
       if(student[i].fname[j]==' ')
       student[i].fname[j+1]=toupper(student[i].fname[j+1]);

     }
   }


 //for input of marks
 void marks(stud student[5],subj sub[5])
 { cout<<"Enter the Marks of the foll Student\n";
 for (int i=0;i<5;i++)
  {
    student[i].total=0;
    cout<<student[i].name<<"\n";
    for (int j=0;j<5;j++)
     {
       cout<<sub[j].name<<" = ";
       cin>>student[i].m[j];
      student[i].total+=student[i].m[j];

     }
     student[i].perc=student[i].total/5;
     average+=student[i].total;
     if(student[i].perc>=90)
       student[i].grade='A';
else if((student[i].perc<90)&&(student[i].perc>=75))
student[i].grade='B';
 else if((student[i].perc<75)&&(student[i].perc>=60))
   student[i].grade='C';
   else if((student[i].perc<60)&&(student[i].perc>=40))
     student[i].grade='D';
     else  student[i].grade='F';
   }
 }

//for showing the data
void show(stud student[5],subj sub[5])
 {
 for (int i=0;i<5;i++)
   {
    cout<<"the name of student....\n"<<student[i].name<<"\nAddress...."<<student[i].address<<"\nFather's name...\n"<<student[i].fname<<endl;
    for(int j=0;j<5;j++)
    cout<<sub[j].name<<"=="<<student[i].m[j]<<endl;
   }
 }

//for sorting students according to names
void sorting(stud student[5], stud child)
{
int a,b,k=0;
    for(int i=0;i<5;i++)
   {
    for(int j=i+1;j<5;j++)
    {
      k=0;
      _1:
      a=tolower(student[i].name[k]);
      b=tolower(student[j].name[k]);
      if(b<a)
      {
child=student[j];
student[j]=student[i];
student[i]=child;
      }
      if(b==a)
{
 k+=1;
 goto _1;
}
     }
  }

}
//for roll no.
void roll(stud student[5])
{
 for(int i=0;i<5;i++)
 student[i].roll=i+1;
 }
// for creating arrays
void creatn_arrays(stud student[5],subj sub[5],stud child)
 {
  names(student);
  address(student);
  fname(student);
  marks(student,sub);
  sorting(student,child);
  roll(student);
 }
 //for report card
 void reportcard(stud student[5],subj sub[5])
 { char a;int r;
   cout<<"NAME LIST\n(Roll No.---Name---)\n";
   for(int i=0;i<5;i++)
   {
   cout<<student[i].roll<<". "<<student[i].name<<endl;
   }
  _1:
  cout<<"Enter the roll no. of the student whose report card is to be seen...."<<endl;
  for(i=0;i<5;i++)
    {
     cout<<student[i].roll<<". "<<student[i].name<<endl;
    }
    cin>>r;
    cout<<"NAME - "<<student[r-1].name<<endl<<"ROLL NO.-"<<r<<endl<<"FATHER'S NAME - "<<student[r-1].fname<<"\nADDRESS - "<<student[r-1].address<<"\nMarks--\n";
    for(i=0;i<5;i++)
    cout<<sub[i].name<<"-- "<<student[r-1].m[i]<<endl;
    cout<<"Total marks(out of 500)= "<<student[r-1].total<<"\nPercentage = "<<student[r-1].perc<<"\nGRADE = "<<student[r-1].grade<<endl;
    cout<<"Do you want to see report card more? y/n\n";
    cin>>a;
    if(a=='y')
    goto _1;
    }
 //for merit list
 void merit_list(stud student[5])
 {
  cout<<"Merit List(--roll no.--name--total--average--)"<<endl;
  for(int i=0;i<5;i++)
  cout<<student[i].roll<<". "<<student[i].name<<"    "<<student[i].total<<"    "<<average/5<<endl;
 }

 //for grade card
 void grade_card(stud student[5])
 {
  cout<<"Grade Card(roll no.--name--Total--Grade--)"<<endl;
  for(int i=0;i<5;i++)
  cout<<student[i].roll<<". "<<student[i].name<<"    "<<student[i].total<<"    "<<student[i].grade<<endl;
 }


void main()
  {
  char a[5];
  int k=0;
  clrscr();
  subj sub[5]={{"Physics"},{"Chemistry"},{"Maths"},{"Computers"},{"English"}};
  creatn_arrays(student,sub,child);

  cout<<"Do you want to Disply the Data Entered ? y/n \n ";
  cin>>a[k];
  if (a[k++]=='y')
  show(student,sub);
  reportcard(student,sub);
  cout<<"Do you want to disply the Merit List ? y/n \n ";
  cin>>a[k];
  if (a[k++]=='y')
  merit_list(student);
  cout<<"Do you want to disply the Grade card ? y/n \n ";
  cin>>a[k];
  if (a[k++]=='y')
  grade_card(student);
  cout<<"Thanks for using this program :-) :-)\n A program Lakshay :-D\n";
  getch();
  }


        // HERE ARE SOME OUTPUT SCREENS







No comments:

Post a Comment