Switch to If statement

This is a part of my program, that queries the user If they want to see the process of sorting numbers in order of highest to lowest. The program works but the code is repetitive. I was informed that it is possible to change it into a switch statement. But I can not figure out how.

do // query for trace
{
system ("cls");

cout << setw (48) << "Initiate Trace?";
Skipline (2, c);
cout << setw (55) << "Enter y for yes or n for no: ";
cin >> reply;
}
while ((reply != 'n') && (reply != 'N') &&
(reply != 'y') && (reply != 'Y'));

switch (reply)
{
case 'n': ;
case 'N': do
{
for (red = blue + 1; red >= 2; red--)
{
if (y [red] > y [red - 1])
{
temp = y [red];
y [red] = y [red - 1];
y [red - 1] = temp;
}
}

blue++;
}
while (blue != count);

break;

case 'y': ;
case 'Y': system ("cls");

do
{
for (red = blue + 1; red >= 2; red--)
{
if (y [red] > y [red - 1])
{
temp = y [red];
y [red] = y [red - 1];
y [red - 1] = temp;
Trace (y, count);
}
}

blue++;
}
while (blue != count);

cin.get ();
}

return;
}
Topic archived. No new replies allowed.