## BecomeMyFan=D 4 years ago Is there a mathematical way to do what this C program does

1. BecomeMyFan=D

#define close_enough 0.01 main() { char facts[] = {"fat (grams)", "calcium (%)", "carbs (grams)", "vitamin D (%)", "cholesterol (%)" }; double ingred[3][5] = { { 0, 1, 2, 4, 3 }, { 3, 4, 5, 0, 3 }, { 0, 6, 0, 7, 8 } }; int numbers_should_equal_this[] = { 15, 43, 4, 7 ,3}; int looper[3]; for (looper[0] = 0 ; looper[0] < 100 ; looper[0]++) for (looper[1] = 0; looper[1] < 100 - looper[0]; looper[1]++) for (looper[2] = 0; looper[2] < 100 - (looper[0] + looper[1]) ; looper[2]++) if (ingred[0][0] * (looper[0] / 100.0) < close_enough) if (inged[1][0] * (looper[1] / 100.0) < close_enough) if (sugar[2][0] * (looper[1] / 100.0) < close_enough)

2. BecomeMyFan=D

:) it is not complete, but you get the idea

3. lokisan

What is it meant to do?

4. lokisan

You do have a mathematical way to do this - it's your algorithm.

5. suzi20

this is not complete but complicated

6. sstarica

I'm closing my eyes. I had a test yesterday in Object Oriented Programming ._.

7. BecomeMyFan=D

it will figure out what ratios of ingredients are needed for a given food. For example I have a cheesecake snack which contains only cream cheese, sour cream, sugar and eggs. I know from the box the nutritional facts of the box, and I know the nutritional facts about each ingredient. Now with this information I should be able to figure out the ratios with a program that just tries every possibility and checks to see if the numbers work.

8. BecomeMyFan=D

simple

9. BecomeMyFan=D

OOP is cool but this is not OPP

10. sstarica

noticed.

11. suzi20

is this linear programming?

12. BecomeMyFan=D

you guys should see my 24000 lines C++ code LOL

13. lokisan

programming scares me

14. BecomeMyFan=D

I guess it is procedural programming, not linear, IMHO

15. BecomeMyFan=D

programming is easier than most ppl think

16. sstarica

lol angoo, I do practice programming, but I don't go deep into it.

17. lokisan

my programs never work properly and i have no patience and just get angry

18. BecomeMyFan=D

what language do you use loki

19. sstarica

LOL , let me guess, error error unable to complie LOL

20. lokisan

some random crap

21. sstarica

which language do you use? Java, C++? C? C# etc etc

22. suzi20

i used C program with bloodshed dev c++

23. BecomeMyFan=D

you can learn enough of programming to make a simple text based role playing game in about a month

24. lokisan

I don't know. I was forced to do some as part of my degree. C or something.

25. sstarica

I use Java , since it's the only language available to practice here in campus

26. BecomeMyFan=D

YEY!!! I also used to use Bloodshed

27. lokisan

Yeah, you're all nerds...

28. sstarica

lol =D

29. BecomeMyFan=D

I ain't a nerd, you should see me in real life LOL, you would be surprised

30. BecomeMyFan=D

I know you are kidding, so am I

31. sstarica

there's a difference between a nerd and a geek, geek = computer more person, nerd = study more person lol

32. suzi20

to make a mathematical program from complicated case, u have to learn linear programming, i think.

33. sstarica

no need

34. lokisan

so you're saying if i saw you, i *would* think you were a nerd?

35. sstarica

I was so proud of the program I wrote lol, finding the factorial of a number >_<

36. sstarica

it took me AGES ._.

37. BecomeMyFan=D

no, you would not, not a chance, everyone is surprised when I tell them I am into computers and geek stuff

38. BecomeMyFan=D

they think I am a bodybuilder or something

39. BecomeMyFan=D

kidding, no, in real life you it is quite easy to see I am into TECH

40. suzi20

in the end noone can solve ur algorithm lol

41. sstarica

lol, in other words , a geek with a pretty smile =D I guess?

42. BecomeMyFan=D

=D

43. BecomeMyFan=D

I am just trying to confuse you all

44. BecomeMyFan=D

LOL =D

45. sstarica

not working here ^_^

46. lokisan

Yeah, I'm confused.

47. sstarica

LOL!

48. suzi20

hahaha

49. sstarica

then angoo striked one person, he's what do you call that thing, um, socializing thingy?

50. BecomeMyFan=D

so guys, anyone wants C++ lessons? *eating a bannana*

51. suzi20

BMF u made a HERO confused, well done

52. sstarica

he has done it before lol

53. sstarica

loki is drunk ~

54. sstarica

bananas get you excited LOL

55. lokisan

I never want to see C++ or any C again

56. sstarica

I have never even seen C++ or C

57. suzi20

i want to see A always

58. lokisan

If I can't do it with pen and paper or on excel, i get someone to write up a program

59. BecomeMyFan=D

C++ is very simmilar to java

60. sstarica

try try try again and again

61. sstarica

that's what I've heard andy

62. sstarica

but they say C++ is alot more easier than Java

63. lokisan

my problem is that it's so finicky. so much room for error. one mistake and you can spend hours looking for it.

64. BecomeMyFan=D

and, no, bananas do NOT get me excited, they are just fruit

65. sstarica

lol, they get you excited :)

66. BecomeMyFan=D

nah, java and C++ are exactly of same difficulty

67. suzi20

ahh outta topic

68. sstarica

they have a very long-named chemical that I don't remember that gives you energy ^_^ same thing with chocolate and barely. I forgot the name hmm wait

69. BecomeMyFan=D

just that, java is used for one thing, and C++ in other situations

70. sstarica

Oh yeah, Tryptophan! :) that's what it's called

71. lokisan

Tryptophan puts you to sleep!

72. sstarica

banana , choco, and barely = goog for heart = because they contain serotonin.

73. lokisan

it's in turkey

74. sstarica

lol, it's in bananas, chocolate and barely lol

75. sstarica

I have attended an Organic Chemistry course for fun ^_^

76. BecomeMyFan=D

Java: -Finances -Web -Simple boring games C++ -Operating Systems -Almost all comercial software -Bank server software -Airplane software -3D games (like for PS3, PC...)

77. sstarica

but they're using java now

78. BecomeMyFan=D

who?

79. suzi20

folks, all of u get a job, someone asking about max domain

80. sstarica

everyone

81. sstarica

I'm not sure of the maximal domain >_<

82. BecomeMyFan=D

nope, not everyone, java is great for smal programs, C++ is good for complex comercial ones, the multimilion ones

83. sstarica

They've stopped teaching C++ though

84. BecomeMyFan=D

do you know why? because with java it is easyer to make simple programs and dysplay simple graphics, which is good for learning, but C++ can take very long time to learn, just to draw a cube on the screen is hard

85. sstarica

They say that in computer engineering, C++ will be taught and Java will be ignored.

86. sstarica

anyways, languages are languages, all function the same in the end.

87. sstarica

all have one place to go, all have same use.

88. sstarica

stupid computer with some human intelligence

89. sstarica

obedient to the rules.

90. sstarica

etc.

91. BecomeMyFan=D

check this, it has a simple C++ program with two 3D objects spinning aroun, AND a cpp file with the SOURCE CODe

92. BecomeMyFan=D

so finaly you can see how C++ looks and how much code you need to do that simple stuff

93. sstarica

I'll check it later , thanks

94. sstarica

I guess

95. BecomeMyFan=D

oh, and check this, it is more fun# =D

96. BecomeMyFan=D

:)

97. sstarica

will do

98. BecomeMyFan=D

make sure to examine the code =D LOL

99. BecomeMyFan=D

the cpp file

100. sstarica

not in my current mood lol, but I will later.

101. sstarica

thank you.

102. nowhereman

If you want a mathematical way, you should consider functional programming. e.g. Haskell

103. sstarica

lol, finally someone has answered the question that was displayed

104. BecomeMyFan=D

ok, I will check out haskell, shouldn't be hard after learning C++

105. sstarica

if you're good at the previous ones, then the new ones will be easily absorbed by you ^_^

106. nowhereman

Well, it is, after all, a different programming paradigm. You not only have to learn new names and a little syntax, but you also have to think differently about your algorithms — in a more mathematical way.

107. sstarica

yeah, algorithms algorithms

108. sstarica

I'm off to go soon, later :)