Credit System calculator Solved Project

Credit system calculator for percentage calculation of higher study students semester marks
In this coding project, we present credit system percentage calculator for all semesters. This project is coded using C language under TURBO C++ with graphics. Since credit system is use mostly in all universities to differentiate toughness(or hours of study) of different subjects. We present this calculator code for our college students for their percentage calculate using credit system.
You can manipulate credits for theory and practical in given code according to their university.

C LANGUAGE CODE:

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#define MM 100
void main()

{
                re:
                int tt=0,th=0,pr2=0,pr3=0,pr1=0,i,j,gt=0,gm=0,sem,tcredit=0,d=DETECT,h=CGA,mx,my,x=20,y=60,mar[50],p=0,sum[5]={0,0},credit=0;
                long sm=0,ms=0;
                char mss[10]={'\0'},is[50]={'\0'},s[51][20],gts[10]={'\0'},gms[10]={'\0'},credits[50]={'\0'},sms[50]={'\0'},tcredits[50]={'\0'};
                clrscr();

                printf("\nEnter your Semester:\t");
                scanf("%d",&sem);
                printf("\n\nEnter the number of theory subjects (4 credits):\t");
                scanf("%d",&th);
                printf("\n\nEnter the number of practical subjects of 3 credits:\t");
                scanf("%d",&pr3);
                printf("\n\nEnter the number of practical subjects of 2 credits:\t");
                scanf("%d",&pr2);
                printf("\n\nEnter the number of practical subjects of 1 credit :\t");
                scanf("%d",&pr1);
                tt=th+pr3+pr2+pr1;
                printf("\n\nEnter your marks:");
                i=5;
                for(j=20;p<tt;j+=2)
                {
                                p++;
                                gotoxy(i,j);
                                if(p<=th)
                                {
                                                if(p<10)
                                                printf("0%d.Theory    (4 credits) %d     :",p,p);
                                                else
                                                printf("%d.Theory    (4 credits) %d    :",p,p);
                                }
                                else if(p<=th+pr3)
                                {
                                                if(p<10)
                                                printf("0%d.Practical (3 credits) %d     :",p,p-th);
                                                else
                                                printf("%d.Practical (3 credits) %d     :",p,p-th);
                                }
                                else if(p<=th+pr3+pr2)
                                {
                                                if(p<10)
                                                printf("0%d.Practical (2 credit)  %d     :",p,p-th-pr3);
                                                else
                                                printf("%d.Practical (2 credit)  %d     :",p,p-th-pr3);
                                }
                                else if(p<=tt)
                                {
                                                if(p<10)
                                                printf("0%d.Practical (1 credit)  %d     :",p,p-th-pr3-pr2);
                                                else
                                                printf("%d.Practical (1 credit)  %d     :",p,p-th-pr3-pr2);
                                }
                                scanf("%d",&mar[p]);
                                if(mar[p]<40)
                                {
                                                gotoxy(i+35,j);
                                                printf("FAIL");
                                }
                                if (mar[p]<0||mar[p]>MM)
                                {
                                                printf("\nMarks should not exceed 100.");
                                                getch();
                                                clrscr();
                                                goto re;
                                }
                }
                for(i=1;i<=tt;i++)
                                itoa(mar[i],s[i],10);
                for(i=1;i<=tt;i++)
                {
                                if(i>=1&&i<=th)
                                {
                                                tcredit+=4;
                                                if(mar[i]>=40)
                                                {
                                                sum[4]+=4*mar[i];
                                                credit+=4;
                                                }
                                }
                                else if(i<=th+pr3)
                                {
                                                tcredit+=3;
                                                if(mar[i]>=40)
                                                {
                                                sum[3]+=3*mar[i];
                                                credit+=3;
                                                }
                                }
                                else if(i<=th+pr3+pr2)
                                {
                                                tcredit+=2;
                                                if(mar[i]>=40)
                                                {
                                                sum[2]+=2*mar[i];
                                                credit+=2;
                                                }
                                }
                                else if(i<=tt)
                                {
                                                tcredit+=1;
                                                if(mar[i]>=40)
                                                {
                                                sum[4]+=mar[i];
                                                credit++;
                                                }
                                }
                                gm+=mar[i];
                                gt+=MM;
                }
                itoa(gt,gts,10);
                for(i=1;i<=4;i++)
                {
                                sm+=sum[i];
                }
                itoa(gm,gms,10);
                if(credit!=0)
                {
                                sm=(sm*1000.0/credit);
                                ms=sm%1000;
                                sm=sm/1000;
                }
                else
                {
                                sm=0;
                                ms=0;
                }
                itoa(ms,mss,10);
                itoa(tcredit,tcredits,10);
                itoa(sm,sms,10);
                itoa(credit,credits,10);
                initgraph(&d,&h,"");
                mx=getmaxx();
                my=getmaxy();
                setcolor(sem);
                rectangle(2,2,mx-2,my-2);
                setcolor(++sem);
                rectangle(4,4,mx-4,my-4);
                setcolor(++sem);
                rectangle(6,6,mx-6,my-6);
                settextstyle(3,0,5);
                outtextxy(mx/2-25,5,"NSIT");
                settextstyle(4,0,1);
                y=45;
                for(i=1;i<=tt;i++)
                {
                                if(i<=th)
                                {
                                                itoa(i,is,10);
                                                outtextxy(x,y,"Theory    (credit 4)");
                                                outtextxy(x+66,y,is);
                                                y+=30;
                                                if(y>=my-30)
                                                {
                                                                x=260;
                                                                y=45;
                                                }
                                }
                                else if(i<=th+pr3)
                                {
                                                itoa(i-th,is,10);
                                                outtextxy(x,y,"Practical   (credit 3)");
                                                outtextxy(x+66,y,is);
                                                y+=30;
                                                if(y>=my-30)
                                                {
                                                                x=260;
                                                                y=45;
                                                }
                                }
                                else if(i<=th+pr3+pr2)
                                {
                                                itoa(i-th-pr3,is,10);
                                                outtextxy(x,y,"Practical   (credit 2)");
                                                outtextxy(x+66,y,is);
                                                y+=30;
                                                if(y>=my-30)
                                                {
                                                                x=260;
                                                                y=45;
                                                }
                                }
                                else if(i<=tt)
                                {
                                                itoa(i-th-pr3-pr2,is,10);
                                                outtextxy(x,y,"Practical   (credit 1)");
                                                outtextxy(x+66,y,is);
                                                y+=30;
                                                if(y>=my-30)
                                                {
                                                                x=260;
                                                                y=45;
                                                }
                                }
                }
                x=185;
                y=45;
                i=0;
                settextstyle(3,0,1);
                for(y;i<tt;y+=30)
                {
                                i++;
                                setcolor(sem);
                                if(y>=my-30)
                                {
                                                x=420;
                                                y=45;
                                }
                                outtextxy(x,y,s[i]);
                                setcolor(RED);
                                if(mar[i]<40)
                                {
                                                outtextxy(x+28,y,"FAIL");
                                }
                }
                //outtextxy(500,80,"credits");
                outtextxy(500,100,credits);
                //outtextxy(500,150,"percentage");
                outtextxy(500,170,sms);
                if (sm==100)
                                i=539;
                else if(sm>0)
                                i=526;
                else
                                i=513;
                outtextxy(i,170,".");
                outtextxy(i+5,170,mss);
                //outtextxy(500,220,"Total Marks");
                outtextxy(500,240,gms);
                settextstyle(6,0,2);
                //outtextxy(500,my-100,"Grand Total");
                outtextxy(500,my-80,gts);
                //outtextxy(500,my-60,"Total credit");
                outtextxy(500,my-40,tcredits);
                setcolor(GREEN);

                outtextxy(500,80,"credits");
                outtextxy(500,150,"percentage");

                outtextxy(500,220,"Total Marks");
                outtextxy(500,my-100,"Grand Total");
                outtextxy(500,my-60,"Total credit");

getche();
}

Run this program under TURBO C++ and check your percentage.

Happy Reading!

No comments:

Powered by Blogger.