[Solved] Error declaring in scope


In function main, you call function displayBills, yet the compiler does not know this function at this point (because it is declared/defined later in the file).

Either put the definition of displayBills(int dollars) { ... before your function main, or put at least a forward declaration of this function before function main:

displayBills(int dollars);  // Forward declaration; implementation may follow later on;
// Tells the compiler, that function `displayBills` takes one argument of type `int`.
// Now the compiler can check if calls to function `displayBills` have the correct number/type of arguments.

int main() {
   displayBills(dollars);  // use of function; signature is now "known" by the compiler
}

displayBills(int dollars) {  // definition / implementation
  ...
}

BTW: there are several issues in your code which you should take care of, e.g. using namespace std is usually dangerous because of unintended name clashes, functions should have an explicit return type (or should be void), …

solved Error declaring in scope