[[lesson_6_mathvars.cpp]] Rescued by C++ Reloaded

Route:


[user02@FC4 Lesson06]$ cat -n mathvars.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 float cost = 15.50; // The cost of an item 7 float sales_tax = 0.06; // Sales tax is 6 percent 8 float amount_paid = 20.00; // The amount the buyer paid 9 float tax, change, total; // Sales tax, buyer change and 10 // total bill 11 12 tax = cost * sales_tax; 13 total = cost + tax; 14 change = amount_paid - total; 15 16 cout << "Item Cost: $" << cost << "\tTax: $" << tax << "\tTotal: $" << total << endl; 17 18 cout << "Customer change: $" << change << endl; 19 20 return 0; 21 }
[user02@FC4 Lesson06]$ g++ -o mathvars mathvars.cpp
[user02@FC4 Lesson06]$ ./mathvars
Item Cost: $15.5 Tax: $0.93 Total: $16.43
Customer change: $3.57
lesson_6_mathvars.cpp, Rev. 1, Last changed on 2005-08-09 02:08, 280 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.181 seconds || || PAGERANK TOOLS