I need help in writing a program that asks a user to input a letter to see if the letter inputed is in the program. Then if it is true the program returns the position of where the text is located. If it is false then it says no match found. Then i have to error check to see that the input was really a character.
MY CODE SO FAR
#include<stdio.h>
int found_number(int a[], int, int);
void getch(int array[], int, int);
int main()
{
int char[] = { "Hello World"};
if( found_number( char, 9, 4))
printf("Found It!\n");
else
printf("No Such Luck...\n");
getch(char, 9, 4);
}
return 0;
}
void getch(int array[], int count, int search)
{
int i;
for (i = 0; i < count; i++)
{
if (array[i]== search)
break;
}
if (i==count)
printf('\n %d was not found in Array", search);
else
printf ("\n%d was not found in slot %d", search, i);
}
PLEASE HELP
return 0;
}
int found_number(int array[], int count, int search)
{
int i;
for (i = 0; i < count; i++)
{
if (array[i] == search)
printf("Found it");
else
printf("Match Not Found");
}
return 0;
}