im having trouble completing 1 of assignments intro coding class. keep getting error when compiling, "[error] 'displaybills' not declared in scope. attach code, suggestions appreciated, thanks!
#include <iostream> #include <cstdlib> using namespace std; int main() { int dollars; cout << "please enter whole dollar amount (no cents!). input 0 terminate: "; cin >> dollars; while (dollars != 0) { displaybills(dollars); cout << "please enter whole dollar amount (no cents!). input 0 terminate: "; cin >> dollars; } return 0; } displaybills(int dollars) { int ones; int fives; int tens; int twenties; int temp; twenties = dollars / 20; temp = dollars % 20; tens = temp / 10; temp = temp % 10; fives = temp / 5; ones = temp % 5; cout << "the dollar amount of ", dollars, " can represented following monetary denominations"; cout << " twenties: " << twenties; cout << " tens: " << tens; cout << " fives: " << fives; cout << " ones: " << ones; }
you did not specify forward declaration displaybills
function. must either specify 1 or put function before calls it.
Comments
Post a Comment