This is a program i made..but i wanted it to arrnge the total in decreasing order showin the highest scorer 1st....what more should i do 4 that in this program....???

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];
int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
clrscr();
cout<<"\n\n\n\tEnter roll number\t";
cin>>rollno[i];
cout<<"\n\n\tEACH OUT OF 100\n\n\n";
cout<<"Enter English marks  ";
cin>>english[i];
cout<<"Enter Science marks  ";
cin>>science[i];
cout<<"Enter Social marks   ";
cin>>social[i];
cout<<"Enter Hindi marks    ";
cin>>hindi[i];
cout<<"Enter Maths marks    ";
cin>>maths[i];

}



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>450)
Grade[i]='A';
else if(Total[i]>400)
Grade[i]='A';
else if(Total [i]>300)
Grade[i]='A';
else if(Total[i]>200)
Grade[i]='A';
else Grade[i]='E';

}

for(int i=1;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade";

for(int i=0;i<n;i++)
{


 cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i];

         }



getch();

}

1) Array elements start counting from 0, not 1. That means the first element of Total is Total[0] and loop counters should count from 0 to but not including the number of elements in the array.

Example: The loop counters beginning on line 58 should be (and that's how I write simple bubble sort algorithm too :) )

for(int i=0; i < (n-1); i++)
{
    for(int j = (i+1); j < n; j++)
    {
         // blabla
    }
}

thankz....but when i do that the problem is ...only the highest total comes ist but the roll no and grade are not corresponding to it...ie...in the process of getting the total in the decreasing order the roll no and grade gets interchanged...so what can i do to correct it?....any suggestions

Myself, I would have used a structure for that information so that you can easily sort structures instead of so many simple arrays.

struct student
{
    int total;
    // rest of student info goes here
};

But if you want to leave it the way you have it, then during the swap you have to swap all the arrays, not just the Total array.

for(int i=0; i < (n-1); i++)
{
    for(int j = (i+1); j < n; j++)
    {
       if (Total[j]>Total[i])
       { 
           temp=Total[i];
           Total[i]=Total[j];
           Total[j]=temp;
           temp = Grade[i];
           Grade[i] = Grade[j];
           Grade[j] = temp;
           // etc etc for each of the arrays.
        }//if statement
     }
}

thank you!!......i m using arrays coz i havnt studied structures yet...im just a beginner...

and i did what you sugggested and it says "WARNING-you may lose significant digits.."...and when i run it if i enter 3 values..i get only 2 in the final result.....i have shown the program below...why does this happen?

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];
int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
clrscr();
cout<<"\n\n\n\tEnter roll number\t";
cin>>rollno[i];
cout<<"\n\n\tEACH OUT OF 100\n\n\n";
cout<<"Enter English marks  ";
cin>>english[i];
cout<<"Enter Science marks  ";
cin>>science[i];
cout<<"Enter Social marks   ";
cin>>social[i];
cout<<"Enter Hindi marks    ";
cin>>hindi[i];
cout<<"Enter Maths marks    ";
cin>>maths[i];

}



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>450)
Grade[i]='A';
else if(Total[i]>400)
Grade[i]='A';
else if(Total [i]>300)
Grade[i]='A';
else if(Total[i]>200)
Grade[i]='A';
else Grade[i]='E';

}

for(int i=0;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 temp = Grade[i];
                 Grade[i] = Grade[j];
                 Grade[j] = temp;
                 temp = rollno[i];
                 rollno[i] = rollno[j];
                 rollno[j] = temp;


                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade";

for(int i=0;i<n;i++)
{

cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i];
 if (Grade[i]=='E')
  {cout<<"\t FAIL" ;}
         }



getch();

}

i more doubt...suppose while running the program ....eg for maths mark the maximum limit s 100...but if aperson writes 150 also that runs..but i want to say not possible/wrong entry...for all the 5 subjects...is there anything i can put like'some common instruction to not read the value beyond 100'?..any idea?

You could do something like this:

do
{
    cout<<"Enter English marks  ";
    cin>>english[i];
    if( english[i] > 100)
       cout << "Error\n";
} while( english[i] > 100 );

And if you are going to do that several times just write a function that returns the value

int GetEntry(string prompt)
{
    int value = 0;
    do
    {
          cout << prompt << "\n";
          cin >> value;
          if( value > 100)
              cout << "Error\n";
     } while( value > 100);
    return value;
}

int main()
{
    ...
    English[i] = GetEntry("Enter English Marks");

}

The loops on line 58 and 59 are still wrong. Use the < operator, not the <= operator when counting from 0.

for(int i=0;i<(n-1);i++)     
{  for(int j=(i+1);j<n;j++)

i havnt studied function..so i tried doin the way u told earlier...n now it says 22 errors..n i cant seem to find where the error is............

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];
int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
      clrscr();
      cout<<"\n\n\n\tEnter roll number\t";
      cin>>rollno[i];
      cout<<"\n\n\tEACH OUT OF 100\n\n\n";

        do
   {
        cout<<"Enter English marks  ";
        cin>>english[i];
        if( english[i] > 100)
       cout << "\tWrong entry\n";
    } while( english[i] > 100 );
      do
   {
      cout<<"Enter Science marks  ";
       cin>>science[i];
      if( science[i] > 100)
       cout << "\tWrong entry\n";
     } while( science[i] > 100 );
         do
    {
      cout<<"Enter Social marks  ";
      cin>>social[i];
     if( social[i] > 100)
     cout << "\tWrong entry\n";
    } while( social[i] > 100 );
      do
      {
     cout<<"Enter Hindi marks  ";
      cin>>hindi[i];
      if( hindi[i] > 100)
       cout << "\tWrong entry\n";
        } while( hindi[i] > 100 );
      cout<<"Enter Maths marks    ";
      cin>>maths[i];
       if( maths[i] > 100)
       cout << "\tWrong entry\n";
       } while( maths[i] > 100 );


}  //for statement



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>450)
Grade[i]='A';
else if(Total[i]>400)
Grade[i]='A';
else if(Total [i]>300)
Grade[i]='A';
else if(Total[i]>200)
Grade[i]='A';
else Grade[i]='E';

}

for(int i=0;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 temp = Grade[i];
                 Grade[i] = Grade[j];
                 Grade[j] = temp;
                 temp = rollno[i];
                 rollno[i] = rollno[j];
                 rollno[j] = temp;


                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade";

for(int i=0;i<n;i++)
{

cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i];
 if (Grade[i]=='E')
  {cout<<"\t FAIL" ;}
         }



getch();

}

oh thankz...but still that warning is there...when i enetr three values one of them is missing.....is there any problem with the sorting part of the array?

in this program...if i want to rank the students on the basis of their total marks wat do i do?...i mean where do i assign the rank.....

in this program...if i want to rank the students on the basis of their total marks wat do i do?...i mean where do i assign the rank.....

Well I would imagine that you would sort the records by Total before displaying them. So use any sorting algorithm you like, but it's a little more complicated since if you do any swaps, you'll have to swap the elements in ALL of the arrays, not just the Total array since this is grouped data. Then, after everything is sorted, display as you do. You've already written the display code, right?

I would actually set up a struct instead of having half a dozen or so arrays. Have a struct with the individual scores, the total, the grade, etc., and then have a single array of that struct. Makes the swapping and everything else much much easier in my opinion.

lines 71-79: You assign an 'A' to everybody.

I ran the program and got this

PROGRESS REPORT





        Rollno          Total           Grade

         100            380             A

         300            200             E        FAIL

         200            150             E        FAIL

ok thatassignment A to everyone was a mistake...but still when i run it..n enter 3 values i can c only 2 ..y is that happening?

this is the modified one!!.........

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];
int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
      clrscr();
      cout<<"\n\n\n\tEnter roll number\t";
      cin>>rollno[i];
      cout<<"\n\n\tEACH OUT OF 100\n\n\n";

        do
   {
        cout<<"Enter English marks  ";
        cin>>english[i];
        if( english[i] > 100)
       cout << "\tWrong entry\n";
    } while( english[i] > 100 );
      do
   {
      cout<<"Enter Science marks  ";
       cin>>science[i];
      if( science[i] > 100)
       cout << "\tWrong entry\n";
     } while( science[i] > 100 );
         do
    {
      cout<<"Enter Social marks  ";
      cin>>social[i];
     if( social[i] > 100)
     cout << "\tWrong entry\n";
    } while( social[i] > 100 );
      do
      {
     cout<<"Enter Hindi marks  ";
      cin>>hindi[i];
      if( hindi[i] > 100)
       cout << "\tWrong entry\n";
        } while( hindi[i] > 100 );
        do
        {
      cout<<"Enter Maths marks    ";
      cin>>maths[i];
       if( maths[i] > 100)
       cout << "\tWrong entry\n";
       } while( maths[i] > 100 );


}  //for statement



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>=450)
Grade[i]='A';
else if(Total[i]>=400)
Grade[i]='B';
else if(Total [i]>=300)
Grade[i]='C';
else if(Total[i]>=200)
Grade[i]='D';
else Grade[i]='E';

}

for(int i=0;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 temp = Grade[i];
                 Grade[i] = Grade[j];
                 Grade[j] = temp;
                 temp = rollno[i];
                 rollno[i] = rollno[j];
                 rollno[j] = temp;


                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade";

for(int i=0;i<n;i++)
{

cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i];
 if (Grade[i]=='E')
  {cout<<"\t FAIL" ;}
         }



getch();

}

Well I would imagine that you would sort the records by Total before displaying them. So use any sorting algorithm you like, but it's a little more complicated since if you do any swaps, you'll have to swap the elements in ALL of the arrays, not just the Total array since this is grouped data. Then, after everything is sorted, display as you do. You've already written the display code, right?

.

.........................................................i havnt studied structures so i cant use them....but i dint understand what you meant .i need to know how to rank the students after sorting them in decreasing order of their total...any suggestions..plz reply..

ok thatassignment A to everyone was a mistake...but still when i run it..n enter 3 values i can c only 2 ..y is that happening?

I ran the code you posted last and I entered 3 students that that's exactly what it displayed at the end.

What compiler are you using? I used vc++ 2008 Express, replaced iostream.h with iostream (no .h extension) and added using namespace std; But those changes should not have caused the problem you describe.

.i need to know how to rank the students after sorting them in decreasing order of their total...any suggestions..plz reply..

what do you mean by "rank them" ? assign a number like the first one in the list is 1, the second one is 2, and the third (last) one is 3? That should be easy to do, just use the loop counter as shown in RED below.

for(int i=0;i<n;i++)
{
cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i] << "  Rank: " << i+1;
 if (Grade[i]=='E')
  {cout<<"\t FAIL" ;}

what do you mean by "rank them" ? assign a number like the first one in the list is 1, the second one is 2, and the third (last) one is 3? That should be easy to do, just use the loop counter as shown in RED below.

for(int i=0;i<n;i++)
{
cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i] << "  Rank: " << i+1;
 if (Grade[i]=='E')
  {cout<<"\t FAIL" ;}

my compiler is Boeland 5.0 n the error still persists.

....what i meant by ranking them is assign rank 1 to the one with maximum total.....can u please xplain that 'i+1 logic'...
anywayz i tried doing wat you asked me to...
but it says error "ambigous operators need paranthesis'"...............please do reply if any ideas to solve this and the modified code is shown below..

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];
int rank[limit];
int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
      clrscr();
      cout<<"\n\n\n\tEnter roll number\t";
      cin>>rollno[i];
      cout<<"\n\n\tEACH OUT OF 100\n\n\n";

        do
   {
        cout<<"Enter English marks  ";
        cin>>english[i];
        if( english[i] > 100)
       cout << "\tWrong entry\n";
    } while( english[i] > 100 );
      do
   {
      cout<<"Enter Science marks  ";
       cin>>science[i];
      if( science[i] > 100)
       cout << "\tWrong entry\n";
     } while( science[i] > 100 );
         do
    {
      cout<<"Enter Social marks   ";
      cin>>social[i];
     if( social[i] > 100)
     cout << "\tWrong entry\n";
    } while( social[i] > 100 );
      do
      {
     cout<<"Enter Hindi marks    ";
      cin>>hindi[i];
      if( hindi[i] > 100)
       cout << "\tWrong entry\n";
        } while( hindi[i] > 100 );
        do
        {
      cout<<"Enter Maths marks    ";
      cin>>maths[i];
       if( maths[i] > 100)
       cout << "\tWrong entry\n";
       } while( maths[i] > 100 );


}  //for statement



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>=450)
Grade[i]='A';
else if(Total[i]>=400)
Grade[i]='B';
else if(Total [i]>=300)
Grade[i]='C';
else if(Total[i]>=200)
Grade[i]='D';
else Grade[i]='E';

}

for(int i=0;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 temp = Grade[i];
                 Grade[i] = Grade[j];
                 Grade[j] = temp;
                 temp = rollno[i];
                 rollno[i] = rollno[j];
                 rollno[j] = temp;


                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade\t\t Rank ";

for(int i=0;i<n;i++)
{

cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i] << "  rank: " << i+1;

 if (Grade[i]=='E')
  {cout<<"\t FAIL" ;}
         }



getch();

}

what do you mean by "rank them" ? assign a number like the first one in the list is 1, the second one is 2, and the third (last) one is 3? That should be easy to do, just use the loop counter as shown in RED below.

my compiler is Borand 5.0 n that error still persists.but i got the rank and everything correct(including the logic)...thanks alot..i couldnt have done it without your help
The modified code is below...but while running it the error is still there...no idea why..may b some probs with my compiler..thanks amillion anywayz.

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];

int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
      clrscr();
      cout<<"\n\n\n\tEnter roll number\t";
      cin>>rollno[i];
      cout<<"\n\n\tEACH OUT OF 100\n\n\n";

        do
   {
        cout<<"Enter English marks  ";
        cin>>english[i];
        if( english[i] > 100)
       cout << "\tWrong entry\n";
    } while( english[i] > 100 );
      do
   {
      cout<<"Enter Science marks  ";
       cin>>science[i];
      if( science[i] > 100)
       cout << "\tWrong entry\n";
     } while( science[i] > 100 );
         do
    {
      cout<<"Enter Social marks   ";
      cin>>social[i];
     if( social[i] > 100)
     cout << "\tWrong entry\n";
    } while( social[i] > 100 );
      do
      {
     cout<<"Enter Hindi marks    ";
      cin>>hindi[i];
      if( hindi[i] > 100)
       cout << "\tWrong entry\n";
        } while( hindi[i] > 100 );
        do
        {
      cout<<"Enter Maths marks    ";
      cin>>maths[i];
       if( maths[i] > 100)
       cout << "\tWrong entry\n";
       } while( maths[i] > 100 );


}  //for statement



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>=450)
Grade[i]='A';
else if(Total[i]>=400)
Grade[i]='B';
else if(Total [i]>=300)
Grade[i]='C';
else if(Total[i]>=200)
Grade[i]='D';
else Grade[i]='E';

}

for(int i=0;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 temp = Grade[i];
                 Grade[i] = Grade[j];
                 Grade[j] = temp;
                 temp = rollno[i];
                 rollno[i] = rollno[j];
                 rollno[j] = temp;


                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade\t\t Rank\t\tStatus ";

for(int i=0;i<n;i++)
 {
    cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i] <<"\t\t "<<i+1;
  if (Grade[i]=='E')
   {cout<<"\t\tFAIL" ;}
  else   {cout<<"\t\tPASS" ;}
  }




getch();
}

what do you mean by "rank them" ? assign a number like the first one in the list is 1, the second one is 2, and the third (last) one is 3? That should be easy to do, just use the loop counter as shown in RED below.

my compiler is Borand 5.0 n that error still persists.but i got the rank and everything correct(including the logic)...thanks alot..i couldnt have done it without your help
The modified code is below...but while running it the error is still there...no idea why..may b some probs with my compiler..thanks amillion anywayz.

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


void main()
{
int n;
const int limit=50;
int rollno[limit];
int maths[limit],english[limit],science[limit],social[limit],hindi[limit];
int Total[limit];
char Grade[limit];

int temp;
cout<<"\n\n\n\tEnter the no of students (Max:50)  :" ;
cin>>n;


for(int i=0;i<n;i++)

{
      clrscr();
      cout<<"\n\n\n\tEnter roll number\t";
      cin>>rollno[i];
      cout<<"\n\n\tEACH OUT OF 100\n\n\n";

        do
   {
        cout<<"Enter English marks  ";
        cin>>english[i];
        if( english[i] > 100)
       cout << "\tWrong entry\n";
    } while( english[i] > 100 );
      do
   {
      cout<<"Enter Science marks  ";
       cin>>science[i];
      if( science[i] > 100)
       cout << "\tWrong entry\n";
     } while( science[i] > 100 );
         do
    {
      cout<<"Enter Social marks   ";
      cin>>social[i];
     if( social[i] > 100)
     cout << "\tWrong entry\n";
    } while( social[i] > 100 );
      do
      {
     cout<<"Enter Hindi marks    ";
      cin>>hindi[i];
      if( hindi[i] > 100)
       cout << "\tWrong entry\n";
        } while( hindi[i] > 100 );
        do
        {
      cout<<"Enter Maths marks    ";
      cin>>maths[i];
       if( maths[i] > 100)
       cout << "\tWrong entry\n";
       } while( maths[i] > 100 );


}  //for statement



for(int i=0;i<n;i++)
{
       clrscr();

 Total[i]=maths[i]+english[i]+science[i]+social[i]+hindi[i];

if(Total[i]>=450)
Grade[i]='A';
else if(Total[i]>=400)
Grade[i]='B';
else if(Total [i]>=300)
Grade[i]='C';
else if(Total[i]>=200)
Grade[i]='D';
else Grade[i]='E';

}

for(int i=0;i<=(n-1);i++)
     {  for(int j=(i+1);j<=n;j++)

           { if (Total[j]>Total[i])
               {temp=Total[i];
                Total[i]=Total[j];
                 Total[j]=temp;
                 temp = Grade[i];
                 Grade[i] = Grade[j];
                 Grade[j] = temp;
                 temp = rollno[i];
                 rollno[i] = rollno[j];
                 rollno[j] = temp;


                 }//if statement
           }  //inner for loop
  }//outer for loop


cout<<"\n\n\n\t\t\tPROGRESS REPORT\n\n\n\n\t";

cout<<"\n\n\tRollno\t\tTotal\t\tGrade\t\t Rank\t\tStatus ";

for(int i=0;i<n;i++)
 {
    cout<<"\n\n\t "<<rollno[i]<<" \t\t"<<Total[i]<<" \t\t"<<Grade[i] <<"\t\t "<<i+1;
  if (Grade[i]=='E')
   {cout<<"\t\tFAIL" ;}
  else   {cout<<"\t\tPASS" ;}
  }



getch();

}

Please post the error message(s) and line number(s).

WARNING-you may lose significant digits..

Is that it? And on line 97?

If yes, the warning is telling you that temp is an integer and Grades is a character. You can remove the warning by typecasting Grade[j] = (char)temp;

Please post the error message(s) and line number(s).

Is that it? And on line 97?

If yes, the warning is telling you that temp is an integer and Grades is a character. You can remove the warning by typecasting Grade[j] = (char)temp;

the warning is gone now..but when i run it if i enter 5 students..i cant c the last one correctly... i wonder why!!!!!!

Copy/paste what you see on your monitor when you run the program.
here is what I get when I enter 5 students. What is wrong with it?

PROGRESS REPORT

        Rollno          Total           Grade

         100            400             B

         200            374             C

         400            350             C

         300            325             C

         500            250             D

Copy/paste what you see on your monitor when you run the program.
here is what I get when I enter 5 students. What is wrong with it?

PROGRESS REPORT

        Rollno          Total           Grade

         100            400             B

         200            374             C

         400            350             C

         300            325             C

         500            250             D

thanks alot..it wasnt working yesterday( had errors that i told u )...but today it works perfctly fine as u said...thank you.....mayb the compilers problaem as you said..but now its alright..

can anyone tell me where the error is?

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

void main()
{
 clrscr();
void zero_small(int &,int &);
int a,b;


cout<<"\n\n\n\tEnter the first no  ";
cin>>a;
cout<< "\n\n\n\tEnter the second no  ";
cin>>b;

 zero_small(a,b);
cout<<"\n\n\n\tValue of the first no is "<<a;
cout<<"\n\n\n\tValue of the second no is  "<<b;
getch();
}


void  zero_small(int& a,int &b  )
{
 if (a<b)
  {a==0;  }
else b==0;

return;
}

can anyone tell me where the error is?

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

void main()
{
 clrscr();
void zero_small(int &,int &);
int a,b;


cout<<"\n\n\n\tEnter the first no  ";
cin>>a;
cout<< "\n\n\n\tEnter the second no  ";
cin>>b;

 zero_small(a,b);
cout<<"\n\n\n\tValue of the first no is "<<a;
cout<<"\n\n\n\tValue of the second no is  "<<b;
getch();
}


void  zero_small(int& a,int &b  )
{
 if (a<b)
  {a==0;  }
else b==0;

return;
}
This question has already been answered. Start a new discussion instead.