anonymous
  • anonymous
Is there a mathematical way to do what this C program does
Mathematics
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
#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)
anonymous
  • anonymous
:) it is not complete, but you get the idea
anonymous
  • anonymous
What is it meant to do?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
You do have a mathematical way to do this - it's your algorithm.
anonymous
  • anonymous
this is not complete but complicated
anonymous
  • anonymous
I'm closing my eyes. I had a test yesterday in Object Oriented Programming ._.
anonymous
  • anonymous
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.
anonymous
  • anonymous
simple
anonymous
  • anonymous
OOP is cool but this is not OPP
anonymous
  • anonymous
noticed.
anonymous
  • anonymous
is this linear programming?
anonymous
  • anonymous
you guys should see my 24000 lines C++ code LOL
anonymous
  • anonymous
programming scares me
anonymous
  • anonymous
I guess it is procedural programming, not linear, IMHO
anonymous
  • anonymous
programming is easier than most ppl think
anonymous
  • anonymous
lol angoo, I do practice programming, but I don't go deep into it.
anonymous
  • anonymous
my programs never work properly and i have no patience and just get angry
anonymous
  • anonymous
what language do you use loki
anonymous
  • anonymous
LOL , let me guess, error error unable to complie LOL
anonymous
  • anonymous
some random crap
anonymous
  • anonymous
which language do you use? Java, C++? C? C# etc etc
anonymous
  • anonymous
i used C program with bloodshed dev c++
anonymous
  • anonymous
you can learn enough of programming to make a simple text based role playing game in about a month
anonymous
  • anonymous
I don't know. I was forced to do some as part of my degree. C or something.
anonymous
  • anonymous
I use Java , since it's the only language available to practice here in campus
anonymous
  • anonymous
YEY!!! I also used to use Bloodshed
anonymous
  • anonymous
Yeah, you're all nerds...
anonymous
  • anonymous
lol =D
anonymous
  • anonymous
I ain't a nerd, you should see me in real life LOL, you would be surprised
anonymous
  • anonymous
I know you are kidding, so am I
anonymous
  • anonymous
there's a difference between a nerd and a geek, geek = computer more person, nerd = study more person lol
anonymous
  • anonymous
to make a mathematical program from complicated case, u have to learn linear programming, i think.
anonymous
  • anonymous
no need
anonymous
  • anonymous
so you're saying if i saw you, i *would* think you were a nerd?
anonymous
  • anonymous
I was so proud of the program I wrote lol, finding the factorial of a number >_<
anonymous
  • anonymous
it took me AGES ._.
anonymous
  • anonymous
no, you would not, not a chance, everyone is surprised when I tell them I am into computers and geek stuff
anonymous
  • anonymous
they think I am a bodybuilder or something
anonymous
  • anonymous
kidding, no, in real life you it is quite easy to see I am into TECH
anonymous
  • anonymous
in the end noone can solve ur algorithm lol
anonymous
  • anonymous
lol, in other words , a geek with a pretty smile =D I guess?
anonymous
  • anonymous
=D
anonymous
  • anonymous
I am just trying to confuse you all
anonymous
  • anonymous
LOL =D
anonymous
  • anonymous
not working here ^_^
anonymous
  • anonymous
Yeah, I'm confused.
anonymous
  • anonymous
LOL!
anonymous
  • anonymous
hahaha
anonymous
  • anonymous
then angoo striked one person, he's what do you call that thing, um, socializing thingy?
anonymous
  • anonymous
so guys, anyone wants C++ lessons? *eating a bannana*
anonymous
  • anonymous
BMF u made a HERO confused, well done
anonymous
  • anonymous
he has done it before lol
anonymous
  • anonymous
loki is drunk ~
anonymous
  • anonymous
bananas get you excited LOL
anonymous
  • anonymous
I never want to see C++ or any C again
anonymous
  • anonymous
I have never even seen C++ or C
anonymous
  • anonymous
i want to see A always
anonymous
  • anonymous
If I can't do it with pen and paper or on excel, i get someone to write up a program
anonymous
  • anonymous
C++ is very simmilar to java
anonymous
  • anonymous
try try try again and again
anonymous
  • anonymous
that's what I've heard andy
anonymous
  • anonymous
but they say C++ is alot more easier than Java
anonymous
  • anonymous
my problem is that it's so finicky. so much room for error. one mistake and you can spend hours looking for it.
anonymous
  • anonymous
and, no, bananas do NOT get me excited, they are just fruit
anonymous
  • anonymous
lol, they get you excited :)
anonymous
  • anonymous
nah, java and C++ are exactly of same difficulty
anonymous
  • anonymous
ahh outta topic
anonymous
  • anonymous
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
anonymous
  • anonymous
just that, java is used for one thing, and C++ in other situations
anonymous
  • anonymous
Oh yeah, Tryptophan! :) that's what it's called
anonymous
  • anonymous
Tryptophan puts you to sleep!
anonymous
  • anonymous
banana , choco, and barely = goog for heart = because they contain serotonin.
anonymous
  • anonymous
it's in turkey
anonymous
  • anonymous
lol, it's in bananas, chocolate and barely lol
anonymous
  • anonymous
I have attended an Organic Chemistry course for fun ^_^
anonymous
  • anonymous
Java: -Finances -Web -Simple boring games C++ -Operating Systems -Almost all comercial software -Bank server software -Airplane software -3D games (like for PS3, PC...)
anonymous
  • anonymous
but they're using java now
anonymous
  • anonymous
who?
anonymous
  • anonymous
folks, all of u get a job, someone asking about max domain
anonymous
  • anonymous
everyone
anonymous
  • anonymous
I'm not sure of the maximal domain >_<
anonymous
  • anonymous
nope, not everyone, java is great for smal programs, C++ is good for complex comercial ones, the multimilion ones
anonymous
  • anonymous
They've stopped teaching C++ though
anonymous
  • anonymous
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
anonymous
  • anonymous
They say that in computer engineering, C++ will be taught and Java will be ignored.
anonymous
  • anonymous
anyways, languages are languages, all function the same in the end.
anonymous
  • anonymous
all have one place to go, all have same use.
anonymous
  • anonymous
stupid computer with some human intelligence
anonymous
  • anonymous
obedient to the rules.
anonymous
  • anonymous
etc.
anonymous
  • anonymous
check this, it has a simple C++ program with two 3D objects spinning aroun, AND a cpp file with the SOURCE CODe
1 Attachment
anonymous
  • anonymous
so finaly you can see how C++ looks and how much code you need to do that simple stuff
anonymous
  • anonymous
I'll check it later , thanks
anonymous
  • anonymous
I guess
anonymous
  • anonymous
oh, and check this, it is more fun# =D
anonymous
  • anonymous
:)
anonymous
  • anonymous
will do
anonymous
  • anonymous
make sure to examine the code =D LOL
anonymous
  • anonymous
the cpp file
anonymous
  • anonymous
not in my current mood lol, but I will later.
anonymous
  • anonymous
thank you.
nowhereman
  • nowhereman
If you want a mathematical way, you should consider functional programming. e.g. Haskell
anonymous
  • anonymous
lol, finally someone has answered the question that was displayed
anonymous
  • anonymous
ok, I will check out haskell, shouldn't be hard after learning C++
anonymous
  • anonymous
if you're good at the previous ones, then the new ones will be easily absorbed by you ^_^
nowhereman
  • 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.
anonymous
  • anonymous
yeah, algorithms algorithms
anonymous
  • anonymous
I'm off to go soon, later :)

Looking for something else?

Not the answer you are looking for? Search for more explanations.