this is my first post and I have looked around on the board and havn't really found anything to help me
I understand the very basics of c and I have this program but when it goes into the switch statement under case 1 it jumps past a line to take the user input and I can't figure it out
Code:
menu(); - - - /* calls menu function, displays menu */
scanf("%d", &opt); - - - /* scans for input choice */
while (opt != 3) - - -
{ switch(opt) - /* sets up the switch for options */
{ case 1: - /* option 1 if customer deposits */
printf("Now Please Enter Your User ID: ");
gets(cid); <----------
i = search(cid);
if(i == -1)
puts("\nWe don't show that ID, please try again\n");
puts("\nPlease enter amount you want to deposit\n");
scanf("%f",&amount);
c[i].balance = c[i].balance + amount;
printf("\n Your new account balance is %f", c[i].balance);
break;
case 2:
.
.
.
int search(char cid[])
{ int i;
for(i = 0; i < 5; i++)
if(strcmp(c[i].id, cid) == 0)
return i;}
I have a function search but it jumps past the gets line and goes right to please enter amount to deposit. I need it to be able to retrieve a certain user ID and it jumps over that gets statement
Please help