mercredi 14 août 2019

This is about C++, if statement and variables

Problem desc: The university bookstore has a Kilobyte Day sale every October 24, giving an 8 percent discount on all computer accessory purchases if the price is less than $128, and a 16 percent discount if the price is at least $128. Write a program that asks the cashier for the original price and then prints the discounted price.

I am trying to solve this problem. and I am getting errors in line #24.


#include <iostream>

using namespace std;

int main()
{ double original_price;
    double discount_rate;
    double discount_price;
    cout << "Enter Original Price:" <<endl;

    cin >> original_price;

    //cout << original_price <<endl;

    if (original_price < 128)
    {
        discount_rate = 0.92;
    }
    else
    {

        discount_rate = 0.84;
    }
    double discounted_price = discount_rate * original_price<<endl;
    cout << "discounted_price: "<< discounted_price;




    return 0;
}

error: reference to overloaded function could not be resolved; did you mean to call it?

Aucun commentaire:

Enregistrer un commentaire