Monday, 17 September 2018

Percentage with Arrays...

===========================================================================
                                CODING



#include<conio.h>
#include<iostream.h>
#include<stdio.h>
#include<all.h>

void main()
{
      clrscr();
      first();
      second();
      int a[100],i,j,k,l;
      char name[200];
      float percentage[10],large;
      gotoxy(25,6);
      cout<<"ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸";
      gotoxy(25,7);
      cout<<"³  NAME:                    ³";
      gotoxy(25,8);
      cout<<"ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÑÍÍÍÍÍÍÍÍ͵";
      gotoxy(25,9);
      cout<<"³     SUBJECT     ³  MARKS  ³";
      gotoxy(25,10);
      cout<<"ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍ͵";
      gotoxy(25,11);
      cout<<"³ C++           ³         ³";
      gotoxy(25,12);
      cout<<"ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍ͵";
      gotoxy(25,13);
      cout<<"³ MATHS         ³         ³";
      gotoxy(25,14);
      cout<<"ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍ͵";
      gotoxy(25,15);
      cout<<"³ ENGLISH       ³         ³";
      gotoxy(25,16);
      cout<<"ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍ͵";
      gotoxy(25,17);
      cout<<"³ PHYSICS       ³         ³";
      gotoxy(25,18);
      cout<<"ÆÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍØÍÍÍÍÍÍÍÍ͵";
      gotoxy(25,19);
      cout<<"³ CHEMISTRY     ³         ³";
      gotoxy(25,20);
      cout<<"ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÏÍÍÍÍÍÍÍÍ;";

      for(i=0,j=0;i<=4;i++,j+=5)
      {
  gotoxy(25,4);
  cout<<"STUDENT "<<i+1<<": ";
  gotoxy(34,7);
  for(k=i*20,l=1;name[k-1]!=13;k++,l++)
  {
      name[k]=getche();
  }
  gotoxy(46,11);
  cin>>a[j];
  gotoxy(46,13);
  cin>>a[j+1];
  gotoxy(46,15);
  cin>>a[j+2];
  gotoxy(46,17);
  cin>>a[j+3];
  gotoxy(46,19);
  cin>>a[j+4];
  percentage[i]=(a[j]+a[j+1]+a[j+2]+a[j+3]+a[j+4])/5.00;
  gotoxy(25,4);
  cout<<"           ";
  gotoxy(34,7);
  cout<<"         ";
  gotoxy(46,11);
  cout<<"     ";
  gotoxy(46,13);
  cout<<"     ";
  gotoxy(46,15);
  cout<<"     ";
  gotoxy(46,17);
  cout<<"     ";
  gotoxy(46,19);
  cout<<"     ";
      }
      large=percentage[0];
      for(i=1,j=0;i<=4;i++)
      {
   if(large<percentage[i])
   {    large=percentage[i];
j=i;
   }
      }
      clrscr();
      cout<<"Results are out:";
      for(i=0;i<=4;i++)
      {    cout<<"\n  ";
   for(k=i*20;name[k]!=13;k++)
cout<<name[k];
   cout<<"-> "<<percentage[i]<<"%";  }
      cout<<"\n\nAnd The Topper is \"";
      for(k=j*20;name[k]!=13;k++)
cout<<name[k];
      cout<<"\" With "<<percentage[j]<<"%";
      cout<<"\nWith marks:-";
      cout<<"\n    ¯C++:       "<<a[j*5];
      cout<<"\n    ¯Maths:     "<<a[j*5+1];
      cout<<"\n    ¯English:   "<<a[j*5+2];
      cout<<"\n    ¯Physics:   "<<a[j*5+3];
      cout<<"\n    ¯Chemistry: "<<a[j*5+4];
      getch();
}




===========================================================================

                                OUTPUT








No comments:

Post a Comment