Problem: after choosing operation, supposedly the user would input a string by calling getString()
. But in this case it skips the function where the user input happens and just proceeds calling the function operations.
Anyone has an idea why is this happening?
int main() {
int choose;
char arr[SIZE];
do {
printf("\n\n-----------------------------------\n");
printf("Enter what operation to perform\n");
printf("[1]Ctype Functions\n");
printf("[2]String Functions\n");
printf("-----------------------------------\n\n");
printf("Enter function: ");
scanf("%d", &choose); //choose what operation
char *str = getString(arr); //user input string, also the problem, it skips this part
switch (choose) {
case 1:
printf("\n\n------------------------------------\n");
printf("Function [%d] Selected\n", choose);
printf("------------------------------------\n");
cTypeFunct(str); //calling ctype function operation
getch();
system("cls");
break;
case 2:
printf("\n\n------------------------------------\n");
printf("Function [%d] Selected\n", choose);
printf("------------------------------------\n");
stringFunct(str); //calling string function operation
getch();
system("cls");
break;
}
} while(choose);
return 0;
}