Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Basic program finding out how many miles the user has to run to burn off various foods
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int pizzaCals = 290, fryCals = 198, candyCals = 400; // set values for
- float pizzaOrders, fryOrders, candyOrders, totalCals, miles2Run;
- cout << "How many orders of pizza, fries, and candy did you eat? \n"; //grabbing the # of food items from user
- cout << "Pizza: ";
- cin >> pizzaOrders;
- cout << "Fries: ";
- cin >> fryOrders;
- cout << "Candy: ";
- cin >> candyOrders;
- totalCals = (pizzaCals*pizzaOrders) + (fryCals*fryOrders) + (candyCals*candyOrders); //converting food items--> miles
- cout << "Total cals: " << totalCals << endl;
- miles2Run = totalCals / 100; // printing data back to user
- cout << "You have to run: " << miles2Run << " miles.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement