how to switch that will only show the passing remarks and the failed remarks

#include<iostream>
#include<windows.h>
#include<string.h>
#include<iomanip>
#include<iomanip>
#include<conio.h>
#include<math.h>
#include <algorithm>
#include <vector>
using namespace std;
void gotoxy(int col,int line)
{
COORD coord;
coord.X=col;
coord.Y=line;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}

char option,name[30][30],buff[30];
int a,b,c,d,e,f,y,x,buf,buf1,buf2;
double sub[50],id[50];
float grade[30];
int main()
{

gotoxy(5,5); cout<< "Name of Student";
gotoxy(25,5); cout<< "ID Number:";
gotoxy(35,5); cout<< " Subject Code:";
gotoxy(55,5); cout<< "Grade:";
gotoxy(65,5); cout<< "Remark:";
for(x=1;x<=5;x++)
{
gotoxy(5,8+x);cin>> name[x];
gotoxy(25,8+x);cin>> id[x];
gotoxy(35,8+x);cin>> sub[x];
gotoxy(55,8+x);cin>> grade[x];

if (grade[x]==1)
{
gotoxy(65,8+x);
cout << "PASSED";
}
else if (grade[x]<=3.5)
{
gotoxy(65,8+x);
cout << "PASSED";
}

else
{
gotoxy(65,8+x);
cout << "FAILED";
}

}
{

}
system("cls");

gotoxy(5,5); cout<< "Name of Student";
gotoxy(25,5); cout<< "ID Number:";
gotoxy(35,5); cout<< " Subject Code:";
gotoxy(55,5); cout<< "Grade:";
gotoxy(65,5); cout<< "Remark:";
for (x=1;x<=5;x++)
{
gotoxy(5,8+x); cout << name[x];
gotoxy(25,8+x); cout << id[x];
gotoxy(35,8+x);cout <<sub[x];
gotoxy(55,8+x);cout <<grade[x];
if (grade[x]==1)
{
gotoxy(65,8+x);
cout << "PASSED";
}
else if (grade[x]<=3.5)
{
gotoxy(65,8+x);
cout << "PASSED";
}

else
{
gotoxy(65,8+x);
cout << "FAILED";
}

}
getch();
gotoxy (20,25);
cout<<"Press : <A> Sorting of ID number \n\t";
gotoxy (20,26);
cout<<"Press : <B> Sorting of Subject code \n\t";
gotoxy (20,27);
cout<<"Press : <C> Sorting of grades \n\t";
gotoxy (20,28);
cout<<"Press : <D> Showing only passed remarks \n\t";
gotoxy (20,29);
cout<<"Press : <E> Showing only failed remarks \n\t";
gotoxy (20,30);
cout<<"Press : <F> Exit \n\t";


cin>>option;
cout<<endl<<endl;
system("cls");
switch(option)
{
case 'A' :
for (x=1;x<=5;x++)
{
for (y=1;y<=5;y++)
{
if (id[x]>id[y])
{
buf=id[x];
id[x]=id[y];
id[y]=buf;
buf1=sub[x];
sub[x]=sub[y];
sub[y]=buf1;
buf2=grade[x];
grade[x]=grade[y];
grade[y]=buf2;
strcpy(buff,name[x]);
strcpy(name[x],name[y]);
strcpy(name[y],buff);

}
}
}



gotoxy(5,5); cout<< "Name of Student";
gotoxy(25,5); cout<< "ID Number:";
gotoxy(35,5); cout<< " Subject Code:";
gotoxy(55,5); cout<< "Grade:";
gotoxy(65,5); cout<< "Remark:";
for (x=1;x<=5;x++)
{
gotoxy(5,8+x); cout << name[x];
gotoxy(25,8+x); cout << id[x];
gotoxy(35,8+x);cout <<sub[x];
gotoxy(55,8+x);cout <<grade[x];
if (grade[x]==1)
{
gotoxy(65,8+x);
cout << "PASSED";
}
else if (grade[x]<=3.5)
{
gotoxy(65,8+x);
cout << "PASSED";
}

else
{
gotoxy(65,8+x);
cout << "FAILED";

}





}
case 'B' :
for (x=1;x<=5;x++)
{
for (y=1;y<=5;y++)
{
if (sub[x]>sub[y])
{
a=sub[x];
sub[x]=sub[y];
sub[y]=a;
b=id[x];
id[x]=id[y];
id[y]=b;
c=grade[x];
grade[x]=grade[y];
grade[y]=c;
strcpy(buff,name[x]);
strcpy(name[x],name[y]);
strcpy(name[y],buff);

}
}
}



gotoxy(5,5); cout<< "Name of Student";
gotoxy(25,5); cout<< "ID Number:";
gotoxy(35,5); cout<< " Subject Code:";
gotoxy(55,5); cout<< "Grade:";
gotoxy(65,5); cout<< "Remark:";
for (x=1;x<=5;x++)
{
gotoxy(5,8+x); cout << name[x];
gotoxy(25,8+x); cout << id[x];
gotoxy(35,8+x);cout <<sub[x];
gotoxy(55,8+x);cout <<grade[x];
if (grade[x]==1)
{
gotoxy(65,8+x);
cout << "PASSED";
}
else if (grade[x]<=3.5)
{
gotoxy(65,8+x);
cout << "PASSED";
}

else
{
gotoxy(65,8+x);
cout << "FAILED";

}





}
case 'C' :
for (x=1;x<=5;x++)
{
for (y=1;y<=5;y++)
{
if (grade[x]>grade[y])
{
d=grade[x];
grade[x]=grade[y];
grade[y]=d;
e=id[x];
id[x]=id[y];
id[y]=e;
f=sub[x];
sub[x]=sub[y];
sub[y]=f;
strcpy(buff,name[x]);
strcpy(name[x],name[y]);
strcpy(name[y],buff);

}
}
}



gotoxy(5,5); cout<< "Name of Student";
gotoxy(25,5); cout<< "ID Number:";
gotoxy(35,5); cout<< " Subject Code:";
gotoxy(55,5); cout<< "Grade:";
gotoxy(65,5); cout<< "Remark:";
for (x=1;x<=5;x++)
{
gotoxy(5,8+x); cout << name[x];
gotoxy(25,8+x); cout << id[x];
gotoxy(35,8+x);cout <<sub[x];
gotoxy(55,8+x);cout <<grade[x];
if (grade[x]==1)
{
gotoxy(65,8+x);
cout << "PASSED";
}
else if (grade[x]<=3.5)
{
gotoxy(65,8+x);
cout << "PASSED";
}

else
{
gotoxy(65,8+x);
cout << "FAILED";

}





}

}
getch();
}
Topic archived. No new replies allowed.