🔒 Closed Pahelp

Status
Not open for further replies.
May instructions TS?
ganyan ung dapat ung magiging program lods!!!

Capture.webp
 
C++:
#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;
}
 
C++:
#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 lods
 
C++:
#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 patulong

IMG20220521131411.webp IMG20220521131400.webp IMG20220521131421.webp IMG20220521131314.webp IMG20220521131346.webp IMG20220521131327.webp
 
Formula
Area of rectangle: length * width
Area of square: side * side
Area of triangle: base * height / 2
Area of circle: Pi*radius*radius
 
Kapag else ginamit mo, sa line 41, wala na dapat condition.
Since may condition, tingin ko dapat else if yung nasa line 41

Paki try palitan yung else ng else if.
 
Status
Not open for further replies.

About this Thread

  • 10
    Replies
  • 1K
    Views
  • 2
    Participants
Last reply from:
Aoshinomori

Online now

Members online
964
Guests online
885
Total visitors
1,849

Forum statistics

Threads
2,276,251
Posts
28,968,671
Members
1,231,183
Latest member
Highness08
Back
Top