URI Online Judge Solution |1038 Snack

Here I tried to write everything in standard C++

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
    int x,y;
    double price,z;
    cin>>x>>y;
    if(x==1)
        z=4.00;
    else if(x==2)
        z=4.50;
    else if(x==3)
        z=5.00;
    else if(x==4)
        z=2.00;
    else if(x==5)
        z=1.50;
    price=(z*y);
    cout.setf(ios::fixed);
    cout<<"Total: R$ "<<setprecision(2)<<showpoint<<price<<endl;
    return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *