A store uses the following policy to award discount. If the customer purchases products costing more than ksh 30,000 she is given a discount of 10%, otherwise she is given a discount of 2%. Write a complete C++ program that allows a user to input the total value of purchases then the program computes and outputs the discount a customer will receive.

I assume you can do the I/O

The calculation is

discount = (purchases > 30000) ? 0.10 : 0.02;

drop that into a while loop and The I/O and you're done

Sure! Here's a complete C++ program that prompts the user to input the total value of purchases and calculates the discount based on the store's policy:

```cpp
#include <iostream>
using namespace std;

int main() {
double totalPurchases;
double discount;

// Prompt the user to input the total value of purchases
cout << "Enter the total value of purchases: ";
cin >> totalPurchases;

// Calculate the discount based on the store's policy
if (totalPurchases > 30000) {
discount = 0.10 * totalPurchases;
} else {
discount = 0.02 * totalPurchases;
}

// Output the discount
cout << "The discount you will receive is: " << discount << " Ksh" << endl;

return 0;
}
```

Explanation:

1. We start by including the necessary header file `iostream`, which allows us to use input and output functionalities.
2. We declare two double variables `totalPurchases` and `discount` to store the user input and calculated discount respectively.
3. The program prompts the user to enter the total value of purchases using `cout` (output stream) and `cin` (input stream). The user input is then stored in the `totalPurchases` variable using the `>>` operator.
4. We use an if-else statement to determine the discount based on the store's policy. If the `totalPurchases` is greater than 30000, the discount is calculated as 10% of the `totalPurchases`, otherwise it is calculated as 2% of the `totalPurchases`.
5. Finally, we output the discount to the user using `cout` and end the line with `endl`. The discount is displayed along with the unit "Ksh" for Kenyan Shillings.
6. The program ends with `return 0;` to indicate successful execution.

Now, when you run this program, it will prompt you to enter the total value of purchases, and then it will calculate and display the discount you will receive based on the store's policy.