Continuous Assesment System Mini Project Using C

#include<stdio.h>
#include<conio.h>
#include<stdlib.h> //Use for system("cls") function in Dev C++..

//Function to calculate Attendence marks.......
int Attendence()
{
 int att;
 int amarks;
 printf("Enter the Attendance in presentage   :  ");
 scanf("%d",&att);
 if(att>=90)
   amarks=5;
 else if(att<95 && att>=85)
   amarks=4;
 else if(att<85 && att>=80)
   amarks=3;
 else if(att<80 && att>=75)
   amarks=2;
 else if(att<75 && att>=70)
   amarks=1;
 else
   amarks=0;
 return (amarks);

}
//Function to calculate lab marks.......
int lab()
{
   int totallmarks=0,temp=0;
   int i,j,n=0,lmarks[20];
   printf("Enter the number of pratcicals done(Must be >=10)  : ");
   scanf("%d",&n);
//To read the marks of lab.
   for(i=0;i<n;i++)
   {
       printf("Enter marks of Lab %d :",i+1);
       scanf("%d",&lmarks[i]);
   }
//Sort the lab marks in descending order
   for(i=0;i<n;i++)
   {
       for(j=i+1;j<=n;j++)
       {
           if(lmarks[i]<lmarks[j])
           {
              temp=lmarks[i];
              lmarks[i]=lmarks[j];
              lmarks[j]=temp;
           }
       }
    }
//Take best 8 lab marks and evaluating it.
    for(i=0;i<8;i++)
    {
        totallmarks=totallmarks+lmarks[i];
    }
 
  return (totallmarks);  //Typecast in integer and return.
   
}

//Function to evaluate test marks........
int test()
{
   int totaltmarks=0,temp=0;
   int tmarks[6]={0,0,0,0,0,0},n=0,i=0,j;
  printf("How many test U have taken?(Must be >=3 and <=5)  :  ");
  scanf("%d",&n);
//Reading test marks.......
  for(i=0;i<n;i++)
  {
       printf("Enter marks of Test %d : ",i+1);
       scanf("%d",&tmarks[i]);
  }
//Arrange Testmarks in descending order.
   for(i=0;i<n;i++)
   {
       for(j=i+1;j<=n;j++)
       {
           if(tmarks[i]<tmarks[j])
           {
              temp=tmarks[i];
              tmarks[i]=tmarks[j];
              tmarks[j]=temp;
           }
       }
    }
//Clculate Total test marks with best 2 test out of these.
     for(i=0;i<2;i++)
    {
        totaltmarks=totaltmarks+tmarks[i];
    }
 
   return (totaltmarks);  //Typecast in integer and return.
     
}
void DisplayInfo()
{
    printf("\n\n\n\t\t\t\tA TERM PAPER ON");
    printf("\n\n\t\t\t   Continuous Assesment System");
    printf("\n\n\n\n\n\n\t\t\t\tBy:");
    printf("\n\n\t\t\t\t  Harijendra Kumar Yadav");
    printf("\n\n\t\t\t\t  Reg_No:11106525");
    printf("\n\n\t\t\t\t  Roll_No:RK38T1A02");
   
    printf("\n\n\n\n\t\t\t\t\t\tPRESS ANY KEY TO CONTINUE->");
    getch();
   
}
int main()
{
  int nlab,nsub,choice=1;
  int attendenceMarks,labMarks[10],testMarks[10],WeightlabMarks[10],WeighttestMarks[10],i;
  int totalMarks=0,totalMarksObtain=0;
  DisplayInfo();
  system("cls");//Clear screen...
while(choice==1)
{
//ATTENDENCE....
   attendenceMarks=Attendence();
   totalMarks=totalMarks+attendenceMarks;
   totalMarksObtain=totalMarksObtain+attendenceMarks;
   system("cls");//Clear screen...
//LAB.............
   printf("\tENTER THE NUMBER OF LAB  :   ");
   scanf("%d",&nlab);
   for(i=0;i<nlab;i++)
   {
       labMarks[i]=lab();
       system("cls");//Clear screen...
   }
//TEST.........
   printf("\tENTER THE NUMBER OF SUBJECT  :   ");
   scanf("%d",&nsub);
   for(i=0;i<nsub;i++)
   {
      testMarks[i]=test();
      system("cls");//Clear screen...
   }

//PRINT ATTENDENCE........
   printf("\nATTENDENCE : ");
   printf("\n---------------------------------------------------------------");
   printf("\nMarksObtain\tWeightMarks");
   printf("\n%d\t\t%d",attendenceMarks,attendenceMarks);
 
//PRINT LAB MARKS...........
   printf("\n\nLAB");
   printf("\n---------------------------------------------------------------");
   printf("\nLab\tMarksObtain\tWeightMarks");
   for(i=0;i<nlab;i++)
   {
       printf("\n %d",i+1);
       printf("\t  %d",labMarks[i]);
       WeightlabMarks[i]=(labMarks[i]*10)/100;
       printf("\t\t %d",WeightlabMarks[i]);
   //Calculating TotalMarks...
   totalMarks=totalMarks+labMarks[i];
   totalMarksObtain=totalMarksObtain+WeightlabMarks[i];
   }
 
//PRINT TEST MARKS.........
   printf("\n\nTEST");
   printf("\n---------------------------------------------------------------");
   printf("\nSub\tMarksObtain\tWeightMarks");
   for(i=0;i<nsub;i++)
   {
       printf("\n %d",i+1);
       printf("\t  %d",testMarks[i]);
       WeighttestMarks[i]=(testMarks[i]*20)/100;
       printf("\t\t  %d",WeighttestMarks[i]);
   //Calculating TotalMarks...
       totalMarks=totalMarks+testMarks[i];
       totalMarksObtain=totalMarksObtain+WeighttestMarks[i];
   }
   
//Print TotalMarks........
  printf("\n\nTotal");
  printf("\n----------------------------------------------------------------");
  printf(" \n\tMarksObtain\tWeightMarks");
  printf("   \n\t\t%d  \t\t%d",totalMarks,totalMarksObtain);

  printf("\n\n\t\t\nEnter 1 to continue for another student and 0 to exit.");
  scanf("%d",&choice);
  system("cls");//Clear screen...
}
 
   getch();
   return(0);
}

No comments:

Post a Comment