Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- enum denominations {
- five = 0;
- ten = 0;
- twenty = 0;
- fifty = 0;
- }
- int main {
- int changeInput;
- changeInput = getInput();
- }
- int getInput(){
- int input;
- while( 1 ){ // Infinite while, loops until it gets a valid input
- cout << "Enter change: ";
- cin >> input;
- if( !(change % 5) && change >= 5 && change <= 95 ){ // If modulus returns 0 and variable is 5-95
- return input; // returns valid input and exits getInput function
- } else {
- cout << "invalid input, enter a number between 0-95 in multiples of 5"; // that's not it, chief. Loops to beginning of while()
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement