You have to call the function "currency" in main, and set the return value to a variable.
The code will look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include <iomanip>
usingnamespace std;
float currency() { //You do not need to have any arguments in this function
float number;
cout << "Please enter a number: ";
cin >> number;
return number;
}
int main ()
{
float amount;
amount=currency(); //Runs currency, and assigns returned value to variable "amount"
cout << "That number in currency is: $" << amount << fixed << setprecision(2) << endl;
return 0;
}