The format of the cin is
cin >> value [>> values];
Prompt for a sales amount and print the sales tax.
#include <iostream> using namespace std; #include <iomanip.h> int main()//from ww w.j a v a2 s . c om { float total_sale; // User's sale amount goes here. float stax; // Display a message for the user. cout << "What is the total amount of the sale? "; // Receive the sales amount from user. cin >> total_sale; // Calculate sales tax. stax = total_sale * .07; cout << "The sales tax for " << setprecision(2) << total_sale << " is " << setprecision (2) << stax; return 0; }