Advertisement
okelikai

Miles2Run

Sep 17th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. // Basic program finding out how many miles the user has to run to burn off various foods
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6.  
  7. int main() {
  8.    
  9.     int pizzaCals = 290, fryCals = 198, candyCals = 400; // set values for
  10.     float pizzaOrders, fryOrders, candyOrders, totalCals, miles2Run;
  11.  
  12.     cout << "How many orders of pizza, fries, and candy did you eat? \n"; //grabbing the # of food items from user
  13.     cout << "Pizza: ";
  14.     cin >> pizzaOrders;
  15.     cout << "Fries: ";
  16.     cin >> fryOrders;
  17.     cout << "Candy: ";
  18.     cin >> candyOrders;
  19.    
  20.     totalCals = (pizzaCals*pizzaOrders) + (fryCals*fryOrders) + (candyCals*candyOrders); //converting food items--> miles
  21.     cout << "Total cals: " << totalCals << endl;
  22.    
  23.     miles2Run = totalCals / 100; // printing data back to user
  24.     cout << "You have to run: " << miles2Run << " miles.";
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement