**Question:** function prototypes

```
#include <iostream>
using namespace std;
// Function prototypes
double discount(double total, int percentage);
void receipt(int items, double initial, double amount, int percent, double discount, double final, double change);
int main() {
double total = 0.0;
int items = 0;
int discount_percent = 0;
while (true) {
double item_price;
cout << "Enter item price (or 0 to stop): $";
cin >> item_price;
if (item_price == 0) {
break;
}
total += item_price;
items++;
}
cout << "Enter discount percentage (or 0 for no discount): ";
cin >> discount_percent;
double discount_amount = discount(total, discount_percent);
double amount_rendered = 0.0;
while (amount_rendered < total) {
cout << "Enter amount rendered by the user: $";
cin >> amount_rendered;
if (amount_rendered < total) {
cout << "Amount rendered is less than the total. Please enter a higher amount." << endl;
}
}
double change = amount_rendered - (total - discount_amount);
double final_total = total - discount_amount;
receipt(items, total, amount_rendered, discount_percent, discount_amount, final_total, change);
return 0;
}
double discount(double total, int percentage) {
return total * (percentage / 100.0);
}
void receipt(int items, double initial, double amount, int percent, double discount, double final, double change) {
cout << "\n----- Receipt -----" << endl;
cout << "Items bought: " << items << endl;
cout << "Initial total: $" << initial << endl;
cout << "Amount rendered: $" << amount << endl;
cout << "Discount percentage: " << percent << "%" << endl;
cout << "Equivalent discount amount: $" << discount << endl;
cout << "Final total after discount: $" << final << endl;
cout << "Change: $" << change << endl;
cout << "-------------------" << endl;
}
```