How to round to two decimal places?
Write your question here.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
string productSelected, product[3] = {"Apples", "Bananas", "Pears"};
float cost, productCost[3] = {2.10, 0.89, 2.60};
int i;
char pSign = 156;
cout << "Enter what you want. \n"
<< "1. Apples. \n"
<< "2. Bananas. \n"
<< "3. Pears. \n" << endl;
cin >> i;
i = i - 1;
productSelected = product[i];
cost = productCost[i];
cout << "\n";
cout << "You chose " << productSelected << ", which are " << pSign << cost
<< endl;
cout << "\n";
|
Thank you!
Topic archived. No new replies allowed.