Here is what I have so far
I have received money from main function. My ATM only gives out $10, $20, and $50 so it has to check if the user's cash request is correct.Code:int get_data(int money) { int count2; int new_cash; int error; for (count2 = 0; count2 < 100; count2 += 1){ money = money % 10; if(money != 0){ printf("This machine dispenses ONLY $50, $20, $10...\n\n"); printf("Please enter again"); scanf("%d", &money); new_cash = money; break; } else new_cash = money * 10; } return(new_cash); }
Right now, it either doesn't break out of the loop or it returns the wrong results. Thanks in advance.



LinkBack URL
About LinkBacks


