Jump to content
Forums are back in action! ×

Rough Calorie Counting Algorithm


The Curse

Recommended Posts

I got kinda bored so I half-heartedly put together an algorithm for a TI-84 calculator to calculate calories in a meal.

Feel free to take this algorithm and alter it to actually work, there may be a few bugs I wasn't really paying attention, and to any real programmers out there don't forget that I was designing this for a TI-84 not C++. I left it open ended so you could put as many ingredient lines in it as you wanted. Have at it. :D

Enter name of food item.how many calories per serving? aSolid? Yes = 1 No = 2input zif z = 2then Liquid? Yes = 1 No = 2input yif z = 1then How many servings? (3 Teaspoons = 1Tablespoon = 1/16 cup)serving quantity = bElse If y = 1then How many servings? (8 oz = 1 Cup = 1/2 Pint = 1/4 Quart = 1/8 Gallon)serving quantity =bdisplay b*awould you like to input another food item? Yes = 1 No = 2input xif x = 1 then display how many calories per serving? else if x = 2 then end programinput cSolid? Yes = 1 No = 2input zif z = 2then Liquid? Yes = 1 No = 2input yif z = 1then How many servings? (3 Teaspoons = 1Tablespoon = 1/16 cup)serving quantity = dElse If y = 1then How many servings? (8 oz = 1 Cup = 1/2 Pint = 1/4 Quart = 1/8 Gallon)serving quantity =ddisplay c*dwould you like a total? Yes = 1 No = 2input xif x = 1then Display a* b * c * dif x = 2then display would you like to input another food item? Yes = 1 No = 2input xif x = 1 then display how many calories per serving? else if x = 2 then end programinput eSolid? Yes = 1 No = 2input zif z = 2then Liquid? Yes = 1 No = 2input yif z = 1then How many servings? (3 Teaspoons = 1Tablespoon = 1/16 cup)serving quantity = fElse If y = 1then How many servings? (8 oz = 1 Cup = 1/2 Pint = 1/4 Quart = 1/8 Gallon)serving quantity =fdisplay e*fwould you like a total? Yes = 1 No = 2input xif x = 1then Display a* b * c * d * e * fif x = 2then display would you like to input another food item? Yes = 1 No = 2input xif x = 1 then display how many calories per serving? else if x = 2 then end program

The Curse

Dwarf Adventurer

[sIGPIC][/sIGPIC]

STR: 2 DEX: 3 STA: 2 CON: 4 WIS: 6 CHA: 2

Current Challenge - Health Log

Link to comment

Also feel free to make any additions you'd like and feel free to distribute your/our version where ever you want.

[EDIT:] Only thing is, if you profit off of it let me know. I wont ask for a cut unless you become a billionaire with it, I would just like to know if part of one of my programs ever saw a dime. XD

The Curse

Dwarf Adventurer

[sIGPIC][/sIGPIC]

STR: 2 DEX: 3 STA: 2 CON: 4 WIS: 6 CHA: 2

Current Challenge - Health Log

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

New here? Please check out our Privacy Policy and Community Guidelines