So, have a program I'm working on and so far things seem like they are going like they are supposed to except one thing. When I print the menu for the user and they input something, if the input is not the input for exiting the program, it prints the menu again twice instead of once, and cant see whats up with it.
Thank you.
#include <stdio.h>
#include <string.h>
int main()
{
// setting up array and a few integers i may need//
unsigned char imgSet[10][65538] = {0} ;
//char *input;
char inputarray[2];
char *menu;
char l,L,r,R,a,A,h,H,v,V,t,T,d,D,m,M,q,Q;
char menuinput=0;
int i,vSize, hSize;
int control = 0;
l = 'l';
L = 'L';
r = 'r';
R = 'R';
a = 'a';
A = 'A';
h = 'h';
H = 'H';
v = 'v';
V = 'V';
t = 't';
T = 'T';
d = 'd';
D = 'D';
m = 'm';
M = 'M';
q = 'q';
Q = 'Q';
menu = ("*****OPTION*****MENU***** \nL: Load image \nR: Remove image \nP: Print image \nA: Average image \nH: Horizontal derivative\nV: Vertical derivative\nT: compute hisTogram\nD: search Digram\nM: local Maxima\nQ: Quit program\n*************************\n\n");
while((control == 0))
{
printf("%s\nenter option\n: ",menu);
scanf("%c", &menuinput);
if((menuinput == l) ||(menuinput == L))
printf("input is L\n");
else if((menuinput == 'r') ||(menuinput == 'R'))
printf("input is %c\n",menuinput);
else if((menuinput == 'a') ||(menuinput == 'A'))
printf("input is %c\n",menuinput);
else if((menuinput == 'h') ||(menuinput == 'H'))
printf("input is %c\n",menuinput);
else if((menuinput == 'v') ||(menuinput == 'V'))
printf("input is %c\n",menuinput);
else if((menuinput == 't') ||(menuinput == 'T'))
printf("input is %c\n",menuinput);
else if((menuinput == 'd') ||(menuinput == 'D'))
printf("input is %c\n",menuinput);
else if((menuinput == 'm') ||(menuinput == 'M'))
printf("input is %c\n",menuinput);
else if((menuinput == 'q') ||(menuinput == 'Q'))
printf("Terminating\n",control = 1);
else
printf("\n");
}
}