Ask the quantity and Print the cost if cost is more than 1000 give 10% discount and 1 unit is 100 rs

PHOTO EMBED

Fri Feb 10 2023 07:45:50 GMT+0000 (Coordinated Universal Time)

Saved by @itachi #c++

#include<iostream>
#include<algorithm>
using namespace std;
template<class t>
class total{
    public:
    void discount(int quantity){
        int cost=quantity*100;
        int discount=(cost/100)*10;
        int new_cost=0;
        if(cost>1000){
            new_cost=cost-discount;
            cout<<"Your new cost after discount is-> "<<new_cost<<endl;
        }
        else{
            cout<<"Your cost is-> "<<cost<<endl;
        }
    }   
};

int main(){
    int q;
    cout<<"Enter the quantity how much you want"<<endl;
    cin>>q;
    total<int>t;
    t.discount(q);
    return 0;
}
content_copyCOPY