C++ examples for Language Basics:Console
Compute sales tax and display it with an appropriate message.
#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; }