75) Write a program in C++ to input roll no and registration no of 10 student from an input file identity.txt. Input marks of three subject from another input file marks.txt of 10 student. Calculate total marks of all 10 student. Arrange and print roll no, registration no. and total marks in ascending order to output file named as ascend.txt. Rearrange and print roll no, registration no and total marks to another output file name as descend.txt?

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
                int i,j,temp;
                int rn[10],reg[10],tm[10],s1,s2,s3;
                clrscr();
                ifstream identify("identify.txt");
                ifstream marks("marks.txt");
                ofstream ascend("ascend.txt");
                ofstream descend("descend.txt");
                for(i=0;i<10;i++)
                                {
                                identify>>rn[i]>>reg[i];
                                marks>>s1>>s2>>s3;
                                tm[i]=s1+s2+s3;
                                }
                for(i=0;i<9;i++)
                                for(j=i+1;j<10;j++)
                                                if(tm[j]<tm[i])
                                                                {
                                                                temp=tm[j]; tm[j]=tm[i]; tm[i]=temp;
                                                                temp=rn[j]; rn[j]=rn[i]; rn[i]=temp;
                                                                temp=reg[j]; reg[j]=reg[i]; reg[i]=temp;
                                                                }
                for(i=0;i<10;i++)
                                ascend<<rn[i]<<"\t"<<reg[i]<<"\t"<<tm[i]<<endl;
                for(i=0;i<9;i++)
                                for(j=i+1;j<10;j++)
                                                if(tm[j]>tm[i])
                                                                {
                                                                temp=tm[j]; tm[j]=tm[i]; tm[i]=temp;
                                                                temp=rn[j]; rn[j]=rn[i]; rn[i]=temp;
                                                                temp=reg[j]; reg[j]=reg[i]; reg[i]=temp;
                                                                }
                for(i=0;i<10;i++)
                                descend<<rn[i]<<"\t"<<reg[i]<<"\t"<<tm[i]<<endl;
                identify.close();
                marks.close();
                ascend.close();
                descend.close();
                getch();
}