Thanks for everyones help my program is nearly complete now there is just one problem. It compiles and runs but does not produce the results I want.
Its suppose to tell you how many of each coins is in a specific amount of change for example if its 90 pences it should say 1 of 50, 2 of 20, 0 of 10 and 0 of 5 (pennies are not included).
Instead what is prints out is 256 of 50, 256 of 20, 256 of 10 and 256 of 5 for any amount entered.
Can anyone help me fix this... here is the code:
Thank you in advancedCode:#include<stdio.h> void Getnum1(int &num1) { printf("Please enter a number between 5 and 95 in cents\n"); scanf("%d%*c", &num1); return; } int DoCalc(int num1) { int value = 0; while(num1 >= 50) { num1 = num1 - 50; value = value + 1; } while(num1 >= 20) { num1 = num1 - 20; value = value + 1; } while(num1 >= 10) { num1 = num1 - 10; value = value + 1; } while(num1 >= 5) { num1 = num1 - 50; value = value + 1; } return(value); } void PrintCal(int &value) { printf("(Fifty: %d\n" ,value); printf("Twenty: %d\n" ,value); printf("Ten: %d\n" ,value); printf("Five: %d\n" ,value); return; } int main() { int num1; int value; Getnum1(num1); DoCalc(num1); PrintCal(value); return(0); }



LinkBack URL
About LinkBacks


