I am trying to use an if ... else statement in order to sequence choices. However regardless of what my choice it returns the Fill response. What have I done wrong in the code?
Code:
/*Create the menu of the main function. This is where the user selects the
function they want to us to fill, sort, search or print an array.
Continuation of arrays.cpp which works
*/
#include <stdio.h>
#include <stdlib.h>
//Function Declarations
void functionUse (char choice);
int main (void)
{
//Local Declaration
char letter;
char select;
//Statements
printf ("\t\tMenu\t\t\n");
printf ("=================================================\n\n");
printf ("Select one of the following options:\n");
printf ("\t F. Fill array with a random number series\n");
printf ("\t P. Print the array\n");
printf ("\t S. Sort the array\n");
printf ("\t Q. Query the array\n");
printf ("\t Z. Terminate the program\n");
printf ("\tYour choice is: %2c");
select = scanf ("%c", &letter);
if (select == 'F'||'f')
printf ("\t Fill\n");
else
{
if (select == 'P' || 'p')
printf ("\t Print\n");
else
{
if (select == 'S' || 's')
printf ("\t Sort\n");
else
{ if (select == 'Q' || 'q')
printf ("\t Query\n");
else;
printf ("Your are finished.");
} //else s
}//else p
}//else f
system("PAUSE");
return 0;
} //main
Would appreciate any help.
Thank You.