plasmadash
Addict
- Joined
- May 19, 2016
- Posts
- 53
- Reaction
- 11
- Points
- 77
pahelp naman po sa pag gawa ng cashier program with subtotal, discount and grandtotal.. salamat po
#include <iostream>
using namespace std;
int main()
{
string itemName;
float price;
int quantity;
float subtotal=0, total=0, discount=0;
char decision, withDiscount;
do {
cout << endl << "Item name: ";
cin >> itemName;
cout << "Enter price : ";
cin >> price;
cout << "Enter quantity: ";
cin >> quantity;
cout << "__________________ " << endl;
subtotal = price * quantity;
printf("Total: %.2f\n", subtotal);
total = total + subtotal;
printf("GRAND TOTAL: %.2f\n\n", total);
cout << "Add another item? Y/N: ";
cin >> decision;
decision = toupper(decision);
if (decision != 'Y')
{
cout << "With discount? Y/N: ";
cin >> withDiscount;
withDiscount = toupper(withDiscount);
if (withDiscount == 'Y')
{
cout << "Discount: ";
cin >> discount;
total = total - discount;
cout << "GRAND TOTAL: " << roundf(total * 100 / 100) << endl << endl;
}
}
} while (decision == 'Y');
return 0;
}
salamat lodsC++:#include <iostream> using namespace std; int main() { string itemName; float price; int quantity; float subtotal=0, total=0, discount=0; char decision, withDiscount; do { cout << endl << "Item name: "; cin >> itemName; cout << "Enter price : "; cin >> price; cout << "Enter quantity: "; cin >> quantity; cout << "__________________ " << endl; subtotal = price * quantity; printf("Total: %.2f\n", subtotal); total = total + subtotal; printf("GRAND TOTAL: %.2f\n\n", total); cout << "Add another item? Y/N: "; cin >> decision; decision = toupper(decision); if (decision != 'Y') { cout << "With discount? Y/N: "; cin >> withDiscount; withDiscount = toupper(withDiscount); if (withDiscount == 'Y') { cout << "Discount: "; cin >> discount; total = total - discount; cout << "GRAND TOTAL: " << roundf(total * 100 / 100) << endl << endl; } } } while (decision == 'Y'); return 0; }
lodi bka pwd patulongC++:#include <iostream> using namespace std; int main() { string itemName; float price; int quantity; float subtotal=0, total=0, discount=0; char decision, withDiscount; do { cout << endl << "Item name: "; cin >> itemName; cout << "Enter price : "; cin >> price; cout << "Enter quantity: "; cin >> quantity; cout << "__________________ " << endl; subtotal = price * quantity; printf("Total: %.2f\n", subtotal); total = total + subtotal; printf("GRAND TOTAL: %.2f\n\n", total); cout << "Add another item? Y/N: "; cin >> decision; decision = toupper(decision); if (decision != 'Y') { cout << "With discount? Y/N: "; cin >> withDiscount; withDiscount = toupper(withDiscount); if (withDiscount == 'Y') { cout << "Discount: "; cin >> discount; total = total - discount; cout << "GRAND TOTAL: " << roundf(total * 100 / 100) << endl << endl; } } } while (decision == 'Y'); return 0; }