Compute sales tax and display it with an appropriate message. - C++ Language Basics

C++ examples for Language Basics:Console

Description

Compute sales tax and display it with an appropriate message.

Demo Code

#include <iostream>
using namespace std;
int main()//from www  .  j ava2s  .co  m
{
   float sale, tax;
   float tax_rate = .08;    // Sales tax percentage
   sale = 22.54;
   // Compute the sales tax.
   tax = sale * tax_rate;
   // Print the results.
   cout << "The sales tax is " << tax << "\n";
   return 0;
}

Result


Related Tutorials