Open Means Open Means

#include

////////////////////////////////////////
// The main() function.
////////////////////////////////////////
int main()
{
    float Dues;      // dues amount

    // Read the dues.
    std::cout << "Enter dues amount: ";
    std::cin >> Dues;

    // Are the dues paid on time?
    std::cout << "On time? (y/n) ";
    char yn;
    std::cin >> yn;
    bool Overdue;   // true if overdue, false if on time
    Overdue = yn != 'y';
    float AmountDue; // amount to be computed

    // Use conditional operator to compute.
    AmountDue = Overdue ? Dues * 1.10 : Dues;

    // Display the dues amount.
    std::cout << "Amount due: ";
    std::cout << AmountDue;

    return 0;
}

No comments

Login to post a comment

Show
  • Create an account
  • Forgot your username?
  • Forgot your password?
  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions