Hi i'm doing an introductory course in c++ and having a problem with this assignment:
Write a program that computes the number of calories in a peanut butter and jelly sandwich (two pieces of bread, some amount of peanut butter, some amount of jelly or preserves).
Assume that peanut butter is 7 calories per gram. And let's use Sara Beth's All-Natural Preserves that are only 2 calories per gram. And take note: an ounce is 28 grams.
The program reads in: the number of calories in a slice of bread, and then reads in the amount peanut butter used and the amount of preserves used. These amounts are in ounces!
The program prints exactly one line of output as follows:
YOUR SANDWICH: nnn CALORIES
where "nnn" is the number of calories your program computed.
At the moment that you're using caloriesperslice, ounceofpb, and ounceofjl, you still haven't filled them with the user's input, nor initialized them with any meaningful value, so they contain garbage.