I need this to go back to the top and run read() again. I have put them all in one fucntion ebcause its driving me crazy. this assignment never ends. I sure hope this course does! sever e crippling/blinding migraines dont help but I dont question the CAUSE!
Code:
void read()
{
for(suba = 0; suba < 4; suba++)
{
for(subb = 0; subb < 8; subb++)
{
x = rand()%51;
num[suba][subb] = x;
printf("%4d", num[suba][subb]);
}
printf("\n");
}
printf("\n\nSearch for a number in the array?");
fflush(stdin);
scanf("%c", &ans);
if(ans == 'y' || ans == 'Y')
{
printf("\n\nKey in integer to be searched for:");
fflush(stdin);
scanf("%d", &s);
for(suba = 0; suba < 4; suba++)
{
for(subb = 0; subb < 8; subb++)
{
if(num[suba][subb] == s)
{
printf("\n%d is in the array\n\n", s);
printf("Press enter to continue\n\n");
fflush(stdin);
getchar();
exit(0);
}
else
{
printf("\n%d is not in the array\n\n", s);
printf("Press enter to continue\n\n");
fflush(stdin);
getchar();
exit(0);
}
}
}
}
if(ans == 'N' || ans == 'n')
{
eoj();
}
}