Monday, 21 August 2017

Pyramid with stars

#include<stdio.h>

void main()
{
    int row, c, n, temp;

    printf("Enter the number of rows in pyramid of stars you wish to see ");
    scanf("%d", &n);

    temp = n;

    for (row = 1; row <= n; row++)
    {
        for (c = 1; c < temp; c++)
            printf(" ");

        temp--;

        for (c = 1; c <= 2 * row - 1; c++)
            printf("*");

        printf("\n");
    }//loop end

    return 0;
}

Guess the name project

#include<stdio.h>
#include<stdlib.h>
#define size 20
void loading(void);
void extra(void);
int i,ii,j,k,l;//COUNTER VARIABLES
int RN1,RN2,len,index;//RANDOM NUMBERS,LENGTH of NAME & INDEX of LETTER ENTERED
char ch,chr,name[size],correct[size]="-------------------",wrong[2*size]="---------------------------------------";
char crct[size],wrng[2*size],a,b;
char Boy_Name[180][size]= {
            "Abbas","Ali","Abid","Abrar","Adeel","Adil","Afzal","Afzaal","Ahmed","Kamran",
            "Abdullah","Ahmer","Ahsan","Ajmal","Akbar","Akhtar","Akram","Aqeel","Aqib","Aleem",
            "Shahid","Altaf","Amin","Amir","Amjad","Anwar","Arif","Arsalan","Arshad","Asad",
            "Fawad","Asim","Aslam","Ayaaz","Ayub","Azam","Azeem","Azhar","Aziz","Babar",
            "Hashaam","Bashir","Danial","Danish","Dawood","Ehtisham","Fahad","Faisal","Faiz","Farid",
            "Farrukh","Fawad","Fayaz","Fazal","Hasan","Hussain","Habib","Hafeez","Haider","Hamid",
            "Hameed","Haroon","Harris","Humayun","Ibrahim","Idrees","Iftikhar","Ijaz","Ilyas","Imran",
            "Inzamam","Iqbal","Irfan","Ishaq","Ismail","Jabbar","Jafar","Jalal","Jaleel","Jamal",
            "Jameel","Junaid","Javaid","Jawad","Kabir","Kaleem","Karim","Khalid","Latif","",
            "Mohammad","Mahmood","Majid","Mohsin","Mubashar","Mudassar","Munawar","Murtaza","Musharraf","Mustafa",
            "Muzaffar","Nabeel","Nadeem","Naeem","Nasir","Naseer","Noman","Naveed","Nawaz","Khaliq",
            "Qadir","Qaiser","Qasim","Raza","Rahim","Rahman","Rameez","Rashid","Rauf","Razzaq",
            "Riaz","Rizwan","Saad","Sabir","Sadaqat","Saeed","Saif","Sajid","Saqib","Salim",
            "Khawar","Araib","Salman","Shabbir","Sarfraz","Shafiq","Shahid","Shahzad","Shan","Sheharyar",
            "Sheraz","Shoaib","Shuja","Sohaib","Sohail","Adnan","Tahir","Taimoor","Tanvir","Tariq",
            "Umair","Umar","Usman","Uzair","Waheed","Wajid","Waqar","Wasi","Wasim","Yahya",
            "Yasir","Younis","Yousaf","Zafar","Zaheer","Zahid","Zain","Zaman","Zameer","Zeeshan",
            "Zia","Zohaib","Zubair","Badar","Farooq","Rehman","Waqas","Tabassum","Tasawar","Tayyab"
            };
char Girl_Name[180][size]={
            "Abida","Adeela","Afreen","Afsheen","Aisha","Alina","Amina","Ammara","Ambreen","Arfa",
            "Arzoo","Asma","Atiqa","Azra","Batool","Beenish","Benazir","Bina","Bushra","Fakhra",
            "Farah","Fareeha","Farida","Farzana","Fatima","Firdous","Ghazala","Hajira","Iffat","Irum",
            "Javeria","Kausar","Khadija","Kulsoom","Laila","Lubna","Madeeha","Maimoona","Maleeha","Mariam",
            "Mehek","Momina","Nadira","Nadia","Nafeesa","Nargis","Pakeeza","Parveen","Neelofar","Andaleeb",
            "Hania","Hadia","Hafsa","Hira","Hareem","Tehreem","Rabia","Raeesa","Raheela","Rashida",
            "Ruqaya","Saba","Sabiha","Sadia","Sabahat","Sabeen","Sehar","Saima","Sajida","Sakina",
            "Salma","Sameera","Sana","Sanober","Sara","Seema","Shabana","Shabnam","Shagufta","Shaista",
            "Shakeela","Shamim","Sharmeen","Zoha","Shazia","Shumaila","Sobia","Somaiya","Surayya","Shanza",
            "Sheeza","Tabassum","Tahira","Nasira","Taskeen","Tasneem","Tasawar","Ulfat","Umaira","Uzma",
            "Zunaira","Zahida","Shahida","Yasmeen","Zainub","Zarqa","Zuhra","Zulekha","Aneeqa","Shama",
            "Aalia","Hifza","Aiman","Fazeela","Habiba","Kiran","Aafia","Maleeha","Balqees","Abiha",
            "Arifa","Ambar","Atiya","Warda","Naseem","Sidra","Fozia","Muntaha","Zobia","Saudia",
            "Sofia","Huma","Hina","Sumaira","Rehana","Fajar","Noor","Aiza","Tooba","Resham",
            "Mehwish","Juggan","Iman","Hadiqa","Umaima","Sarwat","Fiza","Mehreen","Tania","Anam",
            "Neelum","Maheen","Iraj","Maham","Gia","Saira","Faiza","Haya","Maria","Meera",
            "Sunbal","Minahil","Natasha","Nosheen","Rubab","Sonia","Zeba","Zara","Deeba","Farwa",
            "Faryal","Fareeha","Mahira","Mahnoor","Maya","Naheed","Nimra","Nirma","Rahat","Sanam"
            };
void main()
    {
    clrscr();
    gotoxy(32,1);
    printf("INSTRUCTIONS:\n\nIn this game, computer will choose a name from a list of names of PAKISTANI boys& girls.\nIt will tell you whether the name chosen is of a BOY or a GIRL and it will");
    printf(" also tell you that how many LETTERS are there in the NAME. It will draw two lines as:----\t(TOTAL NUMBER of LETTERS in NAME)\n--------\t(NUMBER of WRONG characters you can enter)\nwhich");
    printf(" shows that the name chosen consists of 4 LETTERS & you have 8 chances to\nguess the CORRECT LETTERS (i.e. TWICE the LENGTH of NAME).\nThen you will have to START guessing LETTERS");
    printf(" by entering LETTERS. FOR EXAMPLE:\tIf the choosen name is \"ABRAR\" and you guessed \"a\", the computer will put it as:a--a-\n----------\nwhich shows that the letter guessed is PRESENT in");
    printf(" the name at FIRST & FOURTH\nPLACE. NEXT, if you guess \"s\", computer will put it as:\na--a-\ns---------\nwhich shows that the letter guessed is NOT PRESENT in the name. AND SO ON.\nIf the UPPER line fills");
    printf(" before the LOWER line,it means that you have\nSUCCESSFULLY guessed the name. \nIf the LOWER line fills BEFORE the UPPER line, it means that you have FAILED to guess the name. \n\nIf you");
    printf(" want to PLAY, press \"Y\". OTHERWISE, press \"N\" to QUIT. ");
    ch=getch();
//if user wants to play the game.
returnc:i=0;
    if(ch=='Y' || ch== 'y')
        {
        loading();
        strcpy(crct,correct);//copies CORRECT string to CRCT string.
        strcpy(wrng,wrong);//copies WRONG string to WRNG string.
        randomize();
        RN1=random(2);//1st random number.
        RN2=random(180);//2nd random number.
//check if the name to be choosen is of a BOY or a GIRL & assign the choosen name to string NAME.
        if(RN1==0)
            {
            printf("You Have to Guess the Name of a BOY");
            for(ii=0;ii<size;ii++)
                {
                name[ii]=Boy_Name[RN2][ii];
                if(Boy_Name[RN2][ii]=='\0')
                    break;
                }
            }
        else if(RN1==1)
            {
            printf("You Have to Guess the Name of a GIRL");
            for(ii=0;ii<size;ii++)
                {
                name[ii]=Girl_Name[RN2][ii];
                if(Girl_Name[RN2][ii]=='\0')
                    break;
                }
            }
//check LENGTH of NAME choosen.
        len=strlen(name);
        printf("\n\nNAME consists of %d CHARACTERS\n\n",len);
        printf("You have %d chances to guess the correct name\n\n",2*len);
//print the strings CRCT and WRNG.
        for(ii=0;ii<len;ii++)
            printf("%c",crct[ii]);
        printf("\n");
        for(ii=0;ii<2*len;ii++)
            printf("%c",wrng[ii]);


       input1:    for(i=i;;)
            {
        input:  if(i<=2*len)
                {
                index=-1;
                a=b='y';
                printf("\n\n%d chances left",2*len-i);
                printf("\n\nEnter Character ");
                }
                chr=getche();
                printf("\n");
//checks whether the entered character exists in the name or not.
                for(j=0;j<len;j++)
                    if(chr==name[j] || chr==name[j]-32 || chr-32==name[j])
                        {
                        index=j;
                        crct[index]=chr;
                        }
                if(index!=-1)
                    {
                    for(j=0;j<len;j++)
                        if(crct[j]=='-')
                            a='n';
                    if(a=='n')
                        {
                        extra();
                        goto input1;
                        }
                    else
                        {
                        extra();
                        gotoxy(28,13);
                            printf("CONGRATULATIONS! YOU WON");
                        gotoxy(17,15);
                            printf("Press 'y' to PLAY AGAIN or press 'n' to QUIT ");
                                ch=getch();
                        goto returnc;
                        }
                    }
                if(index==-1)
                    {
                    if(i==2*len)
                        goto exit;
                    else
                        for(l=0;l<=2*len;l++)
                            if(wrng[l]=='-')
                                {
                                wrng[l]=chr;
                                goto print;
                                }
                    }
//prints the new strings.
              print:clrscr();
                for(k=0;k<len;k++)
                    printf("%c",crct[k]);
                printf("\n\n");
                for(k=0;k<2*len;k++)
                    printf("%c",wrng[k]);
//Check whether the LOWER line is filled or not. If not, put 'b=n' & take input again until last chance.
                    for(j=0;j<=2*len;j++)
                        if(wrng[j]=='-')
                            b='n';
                    if(b=='n')
                        {
                        i++;
                        goto input;
                        }
                    else if(b=='y')
                        {
                        i++;
                        goto input;
                        }
            exit:   clrscr();
                gotoxy(34,11);
                    printf("SORRY! YOU LOST");
                gotoxy(20,13);
                    printf("The Name that was choosen is \"%s\"",name);
                gotoxy(17,15);
                    printf("Press 'y' to PLAY AGAIN or press 'n' to QUIT ");
                        ch=getch();
                goto returnc;
            }
        }
//if user don't want to play the game.
    else if(ch=='N' || ch=='n')
        {
        clrscr();
        gotoxy(31,12);
            printf("GOOD BYE...TAKE CARE");
        }
//if user enters the wrong input i.e. else than 'y' or 'n'.
    else
        {
        clrscr();
        gotoxy(24,12);
            printf("Press \"Y\" to PLAY & \"N\" to QUIT ");
                ch=getch();
        goto returnc;
        }
    getch();
    }



void extra()
    {
    clrscr();
    for(k=0;k<len;k++)
        printf("%c",crct[k]);
    printf("\n\n");
    for(k=0;k<2*len;k++)
        printf("%c",wrng[k]);
    }




void loading(void)
    {
    int z;
    for(z=5;z>=1;z--)
        {
        clrscr();
        gotoxy(36,10);
            printf("LOADING . . .");
        gotoxy(31,12);
            printf("%d Seconds Remaining",z);
        delay(1000);
        }
    clrscr();
    }

System clock poject

#include<graphics.h>
#include<conio.h>
#include<math.h>
#include<dos.h>
void main()
{
int gd=DETECT,gm;
int x=320,y=240,r=200,i,h,m,s,thetamin,thetasec;
struct  time t;
char n[12][3]={"3","2","1","12","11","10","9","8","7","6","5","4"};
initgraph(&gd,&gm,"C:\\TC\\BGI");/*put the directory which contains
egavga.bgi*/
circle(x,y,210);
setcolor(4);
settextstyle(4,0,5);
for(i=0;i<12;i++)
    {
    if(i!=3)
        outtextxy(x+(r-14)*cos(M_PI/6*i)-10,y-(r-14)*sin(M_PI/6*i)-26,n[i]);
    else
        outtextxy(x+(r-14)*cos(M_PI/6*i)-20,y-(r-14)*sin(M_PI/6*i)-26,n[i]);
    }
gettime(&t);
printf("The current time is: %2d:%02d:%02d.%02d",t.ti_hour, t.ti_min,t.ti_sec, t.ti_hund);
while(!kbhit())
    {
    setcolor(5);
    setfillstyle(1,5);
    circle(x,y,10);
    floodfill(x,y,5);
    gettime(&t);
    if(t.ti_min!=m)
        {
        setcolor(0);
        line(x,y,x+(r-60)*cos(thetamin*(M_PI/180)),y-(r-60)*sin(thetamin*(M_PI/180)));
        circle(x+(r-80)*cos(thetamin*(M_PI/180)),y-(r-80)*sin(thetamin*(M_PI/180)),10);
        line(x,y,x+(r-110)*cos(M_PI/6*h-((m/2)*(M_PI/180))),y-(r-110)*sin(M_PI/6*h-((m/2)*(M_PI/180))));
        circle(x+(r-130)*cos(M_PI/6*h-((m/2)*(M_PI/180))),y-(r-130)*sin(M_PI/6*h-((m/2)*(M_PI/180))),10);
        }
    if(t.ti_hour>12)
        t.ti_hour=t.ti_hour-12;
    if(t.ti_hour<4)
        h=abs(t.ti_hour-3);
    else
        h=15-t.ti_hour;
    m=t.ti_min;
    if(t.ti_min<=15)
        thetamin=(15-t.ti_min)*6;
    else
        thetamin=450-t.ti_min*6;
    if(t.ti_sec<=15)
        thetasec=(15-t.ti_sec)*6;
    else
        thetasec=450-t.ti_sec*6;
    setcolor(4);
    line(x,y,x+(r-110)*cos(M_PI/6*h-((m/2)*(M_PI/180))),y-(r-110)*sin(M_PI/6*h-((m/2)*(M_PI/180))));
    circle(x+(r-130)*cos(M_PI/6*h-((m/2)*(M_PI/180))),y-(r-130)*sin(M_PI/6*h-((m/2)*(M_PI/180))),10);
    line(x,y,x+(r-60)*cos(thetamin*(M_PI/180)),y-(r-60)*sin(thetamin*(M_PI/180)));
    circle(x+(r-80)*cos(thetamin*(M_PI/180)),y-(r-80)*sin(thetamin*(M_PI/180)),10);
    setcolor(15);
    line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180)));
    delay(1000);
    setcolor(0);
    line(x,y,x+(r-70)*cos(thetasec*(M_PI/180)),y-(r-70)*sin(thetasec*(M_PI/180)));
    }
}

Manual Clock Project

#include<graphics.h>
#include<stdio.h>
void clock(void);
void clock1(void);
void main()
{
int a,x,y,d,m;
d=DETECT;
initgraph(&d,&m,"C:\\TC\\BGI");
cleardevice();
setcolor(4);
outtextxy(100,100,"Press Any Key Repeatedly and See the Trick");
clock();
for(x=303,y=150;x<=353;x=x+5)
    {
    setcolor(4);
    line(303,210,x,y+5);
    getch();
    cleardevice();
    clock();
    }
for(x=353,y=155;x<=403,y<=180;x+=5,y+=3)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=403,y=180;y<=250;y=y+5)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=403,y=250;x>=350,y<=270;x-=5,y+=2)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=350,y=270;x>=250;x-=5)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=250,y=270;x>=200,y>=250;x-=4,y-=2)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=200,y=250;y>=170;y-=4)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
for(x=200,y=170;x<=250,y>=150;x+=5,y-=1)
    {
    setcolor(4);
    line(303,210,x,y);
    getch();
    cleardevice();
    clock();
    }
cleardevice();
clock1();
getch();
closegraph();
}

void clock(void)
{
setbkcolor(14);
setcolor(2);
outtextxy(350,150,"1");
outtextxy(250,150,"11");
outtextxy(300,150,"12");

outtextxy(400,170,"2");
outtextxy(400,210,"3");
outtextxy(400,250,"4");

outtextxy(350,270,"5");
outtextxy(300,270,"6");
outtextxy(250,270,"7");

outtextxy(200,250,"8");
outtextxy(200,210,"9");
outtextxy(200,170,"10");

setcolor(1);
line(180,130,420,130);
line(180,290,420,290);
line(180,130,180,290);
line(420,130,420,290);
circle(303,210,7);
setcolor(6);
setlinestyle(0,0,3);
line(303,210,303,250);
setcolor(11);
setlinestyle(0,5,2);
line(303,210,303,155);
}


void clock1(void)
{
setbkcolor(14);
setcolor(2);
outtextxy(350,150,"1");
outtextxy(250,150,"11");
outtextxy(300,150,"12");

outtextxy(400,170,"2");
outtextxy(400,210,"3");
outtextxy(400,250,"4");

outtextxy(350,270,"5");
outtextxy(300,270,"6");
outtextxy(250,270,"7");

outtextxy(200,250,"8");
outtextxy(200,210,"9");
outtextxy(200,170,"10");

setcolor(1);
line(180,130,420,130);
line(180,290,420,290);
line(180,130,180,290);
line(420,130,420,290);
circle(303,210,7);
setcolor(6);
setlinestyle(0,0,3);
line(303,210,303,250);
setcolor(11);
setlinestyle(0,5,2);
line(303,210,313,155);
setcolor(4);
line(303,210,303,155);
getch();
}

Auto clock Project

#include<graphics.h>
#include<stdio.h>
void clock(void);
void clock1(void);
void main()
{
int a,x,y,d,m;
d=DETECT;
initgraph(&d,&m,"C:\\TC\\BGI");
cleardevice();
setcolor(4);
clock();
for(x=303,y=150;x<=353;x=x+10)/*FROM 12 TO 1*/
    {
    setcolor(4);
    line(303,210,x,y+5);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=353,y=155;x<=403,y<=180;x+=10,y+=6)/*FROM 1 TO 2*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=403,y=180;y<=250;y+=10)/*FROM 2 TO 4*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=403,y=250;x>=350,y<=270;x-=10,y+=4)/*FROM 4 TO 5*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=350,y=270;x>=250;x-=10)/*FROM 5 TO 7*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=250,y=270;x>=200,y>=250;x-=8,y-=4)/*FROM 7 TO 8*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=200,y=250;y>=170;y-=8)/*FROM 8 TO 10*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
for(x=200,y=170;x<=250,y>=150;x+=10,y-=2)/*FROM 10 TO 11*/
    {
    setcolor(4);
    line(303,210,x,y);
    delay(1000);
    cleardevice();
    clock();
    }
cleardevice();
clock1();
getch();
closegraph();
}

void clock(void)
{
setbkcolor(14);
setcolor(2);
outtextxy(350,150,"1");
outtextxy(250,150,"11");
outtextxy(300,150,"12");

outtextxy(400,170,"2");
outtextxy(400,210,"3");
outtextxy(400,250,"4");

outtextxy(350,270,"5");
outtextxy(300,270,"6");
outtextxy(250,270,"7");

outtextxy(200,250,"8");
outtextxy(200,210,"9");
outtextxy(200,170,"10");

setcolor(1);
line(180,130,420,130);
line(180,290,420,290);
line(180,130,180,290);
line(420,130,420,290);
circle(303,210,7);
setcolor(6);
setlinestyle(0,0,3);
line(303,210,303,250);
setcolor(11);
setlinestyle(0,5,2);
line(303,210,303,155);
}


void clock1(void)
{
setbkcolor(14);
setcolor(2);
outtextxy(350,150,"1");
outtextxy(250,150,"11");
outtextxy(300,150,"12");

outtextxy(400,170,"2");
outtextxy(400,210,"3");
outtextxy(400,250,"4");

outtextxy(350,270,"5");
outtextxy(300,270,"6");
outtextxy(250,270,"7");

outtextxy(200,250,"8");
outtextxy(200,210,"9");
outtextxy(200,170,"10");

setcolor(1);
line(180,130,420,130);
line(180,290,420,290);
line(180,130,180,290);
line(420,130,420,290);
circle(303,210,7);
setcolor(6);
setlinestyle(0,0,3);
line(303,210,303,250);
setcolor(11);
setlinestyle(0,5,2);
line(303,210,313,155);
setcolor(4);
line(303,210,303,155);
getch();
}

DataBase project of class file 3

DataBase project of class file 3
void inputs(int c[],int so[],int ss[],int sss[],int k)
    {
    int i;
    printf("Enter Roll No.=");
        scanf("%d",&c[k]);
    for(i=0;i<k;i++)
        if(c[k]==c[i])
            {
            printf("Roll No. of Two Students cannot be Same.\n");
            printf("Enter Roll No. Again=");
                scanf("%d",&c[k]);
            }   
    printf("Enter MARKS of SUBJECT 1=");
        scanf("%d",&so[k]);
    printf("Enter MARKS of SUBJECT 2=");
        scanf("%d",&ss[k]);
    printf("Enter MARKS of SUBJECT 3=");
        scanf("%d",&sss[k]);
    }


void mao(int m[],int so[],int ss[],int sss[],int k)
    {
    m[k]=so[k]+ss[k]+sss[k];
    }


void age(float p[],int m[],int k)
    {
    p[k]=m[k]/3.0;
    }

   
void gra(int gd[],float p[],int k)
    {
    if(p[k]>=80)
        gd[k]=1;
    else if(p[k]>=70 && p[k]<80)
        gd[k]=2;
    else if(p[k]>=60 && p[k]<70)
        gd[k]=3;
    else if(p[k]>=50 && p[k]<60)
        gd[k]=4;
    else
        gd[k]=5;
    }


double cavg(int m[],int l)
    {
    int i,sum=0;
    double ca;
    for(i=0;i<l;i++)
        sum=sum+m[i];
    ca=sum/l;
    return ca;
    }


void first_last(int m[],int c[],int l)
    {
    int i,max=m[0],max_index=0,min=m[0],min_index=0;
    clrscr();
    for(i=1;i<l;i++)
        {
        if(max<m[i])
            {
            max=m[i];
            max_index=i;
            }
        else if(min>m[i])
            {
            min=m[i];
            min_index=i;
            }
        }
    printf("Roll Number of TOPPER Student is %d",c[max_index]);
    printf("\nRoll Number of NULL Student is %d",c[min_index]);
    }


void sortA_mao(int c[],int so[],int ss[],int sss[],int m[],float p[],int gd[],int e[],int l)
    {
    int i,j,large,l_index;
    for(i=0;i<l-1;i++)
        {
        large=m[i];
        l_index=i;
        for(j=i+1;j<l;j++)
            {
            if(large<m[j])
                {
                large=m[j];
                l_index=j;
                }
            }
        m[l_index]=m[i];
        m[i]=large;
       
       
        e[i]=c[i];
        c[i]=c[l_index];
        c[l_index]=e[i];           
            e[i]=so[i];
            so[i]=so[l_index];
            so[l_index]=e[i];
        e[i]=ss[i];
        ss[i]=ss[l_index];
        ss[l_index]=e[i];
            e[i]=sss[i];
            sss[i]=sss[l_index];
            sss[l_index]=e[i];
        e[i]=p[i];
        p[i]=p[l_index];
        p[l_index]=e[i];
            e[i]=gd[i];
            gd[i]=gd[l_index];
            gd[l_index]=e[i];
        }
    }


void sortD_mao(int c[],int so[],int ss[],int sss[],int m[],float p[],int gd[],int e[],int l)
    {
    int i,j,small,s_index;
    for(i=0;i<l-1;i++)
        {
        small=m[i];
        s_index=i;
        for(j=i+1;j<l;j++)
            {
            if(small>m[j])
                {
                small=m[j];
                s_index=j;
                }
            }
        m[s_index]=m[i];
        m[i]=small;
       
       
        e[i]=c[i];
        c[i]=c[s_index];
        c[s_index]=e[i];           
            e[i]=so[i];
            so[i]=so[s_index];
            so[s_index]=e[i];
        e[i]=ss[i];
        ss[i]=ss[s_index];
        ss[s_index]=e[i];
            e[i]=sss[i];
            sss[i]=sss[s_index];
            sss[s_index]=e[i];
        e[i]=p[i];
        p[i]=p[s_index];
        p[s_index]=e[i];
            e[i]=gd[i];
            gd[i]=gd[s_index];
            gd[s_index]=e[i];
        }
    }


void fetch(int c[],int so[],int ss[],int sss[],int m[],float p[],int gd[],int el,int l)
    {
    int i,a,loc=-1;
    char g;
    clrscr();
    printf("R.No.\tSUB 1\tSUB 2\tSUB 3\tT.MARKS\t%AGE\tGRADE");
    for(i=0;i<l;i++)
        {
        switch(gd[i])
            {
            case 1:
                g='A';
                break;
            case 2:
                g='B';
                break;
            case 3:
                g='C';
                break;
            case 4:
                g='D';
                break;
            case 5:
                g='F';
                break;
            }
        if(el==c[i])
            {
            loc=i;
            break;
            }
        }   
        if(loc==-1)
            printf("\nSORRY! \x1 RECORD OF \"%d\" DOES NOT EXIST.",el);
        else
            {
            printf("\n%d\t%d\t%d\t%d\t%d\t%0.2f\t%c",c[loc],so[loc],ss[loc],sss[loc],m[loc],p[loc],g);
            }
    }


void display(int s[],int c[],int so[],int ss[],int sss[],int m[],float p[],int gd[],int l,double ca)
    {
    int i;
    char g;
    clrscr();
    printf("S.No.\tR.No.\tSUB 1\tSUB 2\tSUB 3\tT.MARKS\t%AGE\tGRADE\n");
    for(i=0;i<l;i++)
        {
        s[i]=i+1;
        switch(gd[i])
            {
            case 1:
                g='A';
                break;
            case 2:
                g='B';
                break;
            case 3:
                g='C';
                break;
            case 4:
                g='D';
                break;
            case 5:
                g='F';
                break;
            }
        printf("%d\t%d\t%d\t%d\t%d\t%d\t%0.2f\t%c\n",s[i],c[i],so[i],ss[i],sss[i],m[i],p[i],g);
        }
    printf("\nCLASS AVERAGE is=%0.2f",ca);
    }


void S_display(int c[],int so[],int ss[],int sss[],int m[],float p[],int gd[],int l,double ca)
    {
    int i;
    char g;
    clrscr();
    printf("R.No.\tSUB 1\tSUB 2\tSUB 3\tT.MARKS\t%AGE\tGRADE\n");
    for(i=0;i<l;i++)
        {
        switch(gd[i])
            {
            case 1:
                g='A';
                break;
            case 2:
                g='B';
                break;
            case 3:
                g='C';
                break;
            case 4:
                g='D';
                break;
            case 5:
                g='F';
                break;
            }
        printf("%d\t%d\t%d\t%d\t%d\t%0.2f\t%c\n",c[i],so[i],ss[i],sss[i],m[i],p[i],g);
        }
    printf("\nCLASS AVERAGE is=%0.2f",ca);
    }