View more random threads:
- how to make .h file in c++
- info regarding "source file not compiled"
- What is entity with respect to object oriented programming
- What the difference between compiler and debuger?
- object oriented programming what does it mean and what are...
- Define function in c++ May 2011
- using namespace std;"in the code can we compile the...
- Passing 2d array by reference June 2011
- In C++ is SPACE is also a charactor??
- why huffman tree is not an AVL tree not how?
Code:1. #include <iostream> 2. #include <iomanip> 3. using namespace std; 4. 5. void printbill(double kwhused, double rate, double charge, double tax, double total) 6. { 7. // Print Logo 8. cout << "pppppp oooooo w w w eeeeeeee rrrrrrr cccccc oooooo" << endl; 9. cout << "p p o o w w w e r r c c o o" << endl; 10. cout << "p p o o w w w e r r c o o" << endl; 11. cout << "pppppp o o w w w eeeeee rrrrrrr c o o" << endl; 12. cout << "p o o w w w e r r c o o" << endl; 13. cout << "p o o w w w e r r c o o..." << endl; 14. cout << "p o o w w w w e r r c c o o..." << endl; 15. cout << "p oooooo w w eeeeeeee r r cccccc oooooo ..." << endl << endl; 16. 17. // Print column headers 18. cout << setw(10) << "KW/H Used" << setw(10) << "Rate" << setw(10) << "Charge" << setw(10) << "Tax" << setw(10) << "Total"; 19. 20. // Print data 21. cout << setw(10) << kwhused << setw(10) << rate << setw(10) << charge << setw(10) << tax << setw(10) << total << endl << endl; 22. } 23. 24. int main() 25. { 26. // Declare constant variables(rate, taxrate) 27. const double rate = .001; 28. const double taxrate = .05; 29. 30. // Declare variables 31. double charge, kwhused, total, tax; 32. 33. // Get kw/hr use 34. cout << "Please input number of kilowatts used : " << endl << endl; 35. cin >> kwhused; 36. cout << endl << endl << endl; 37. 38. // Calculate charge 39. charge = rate * kwhused; 40. 41. // Calculate tax 42. tax = charge * taxrate; 43. 44. // Calculate total 45. total = tax + charge; 46. 47. // Call the printbill() function 48. printbill(kwhused, rate, charge, tax, total); 49. 50. return 0; 51. }
Sponsored Links
There are currently 1 users browsing this thread. (0 members and 1 guests)