Advertisement
Guest User

coolballs55

a guest
Sep 29th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // Program outputs th cost cost of a quantity of an item
  2.  
  3. #include <iostream.h>
  4. #include <iomanip.h>
  5. #include <fstream.h>
  6.  
  7. int main ()
  8. {
  9. int partNumber; // Integer for the part number of the item
  10. int quantity; // Integer for the quantiy of the item
  11. double PPU; // Double for the price per unit
  12. double total; // Double for the total price off all the items
  13. ifstream inData;
  14.  
  15. inData.open ("Data.In");
  16. inData >> partNumber >> quantity >> PPU;
  17.  
  18. // Calculates the total of the items
  19. total = PPU * quantity;
  20.  
  21. // Outputs the cost of the items
  22. cout << "The total cost of " << quantity << " " << partNumber << " " << "is "
  23. << total << endl;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement