// change.cpp (Just the start, student must finish) // In order to get you started, this is the structure of the first // homework problem. It can be used as-is or modified to suit your // needs. It was compiled and executed as listed here on the input // data change.dat // #include // basic console input/output #include // handy C functions e.g. isdigit using namespace std; // bring standard include files in scope int main() { int amount; // value read by cin while(!cin.eof()) // a loop that ends when a end of file is reached { try // be ready to catch any exceptions and stay in the loop { if(!isdigit(cin.peek())) throw "not a number"; cin >> amount; //read something, hopefully an integer cout << "Input: " << amount ; // start the output line // // PUT YOUR CODE HERE TO COMPUTE CHANGE // do error checking // use cout << for quarters, dimes, nickels, pennies // but do not output zero values cout << endl; // this ends the output line } catch(...){ cout << " no change possible " << endl; } cin.ignore(80, '\n'); // get rid of any junk after the number } // end of while loop cout << "end of change run" << endl; return 0; } // end main