Ask your own question, for FREE!
Mathematics 7 Online
OpenStudy (anonymous):

Is there a mathematical way to do what this C program does

OpenStudy (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)

OpenStudy (anonymous):

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

OpenStudy (anonymous):

What is it meant to do?

OpenStudy (anonymous):

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

OpenStudy (anonymous):

this is not complete but complicated

OpenStudy (anonymous):

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

OpenStudy (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.

OpenStudy (anonymous):

simple

OpenStudy (anonymous):

OOP is cool but this is not OPP

OpenStudy (anonymous):

noticed.

OpenStudy (anonymous):

is this linear programming?

OpenStudy (anonymous):

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

OpenStudy (anonymous):

programming scares me

OpenStudy (anonymous):

I guess it is procedural programming, not linear, IMHO

OpenStudy (anonymous):

programming is easier than most ppl think

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

what language do you use loki

OpenStudy (anonymous):

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

OpenStudy (anonymous):

some random crap

OpenStudy (anonymous):

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

OpenStudy (anonymous):

i used C program with bloodshed dev c++

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

YEY!!! I also used to use Bloodshed

OpenStudy (anonymous):

Yeah, you're all nerds...

OpenStudy (anonymous):

lol =D

OpenStudy (anonymous):

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

OpenStudy (anonymous):

I know you are kidding, so am I

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

no need

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

it took me AGES ._.

OpenStudy (anonymous):

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

OpenStudy (anonymous):

they think I am a bodybuilder or something

OpenStudy (anonymous):

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

OpenStudy (anonymous):

in the end noone can solve ur algorithm lol

OpenStudy (anonymous):

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

OpenStudy (anonymous):

=D

OpenStudy (anonymous):

I am just trying to confuse you all

OpenStudy (anonymous):

LOL =D

OpenStudy (anonymous):

not working here ^_^

OpenStudy (anonymous):

Yeah, I'm confused.

OpenStudy (anonymous):

LOL!

OpenStudy (anonymous):

hahaha

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

BMF u made a HERO confused, well done

OpenStudy (anonymous):

he has done it before lol

OpenStudy (anonymous):

loki is drunk ~

OpenStudy (anonymous):

bananas get you excited LOL

OpenStudy (anonymous):

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

OpenStudy (anonymous):

I have never even seen C++ or C

OpenStudy (anonymous):

i want to see A always

OpenStudy (anonymous):

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

OpenStudy (anonymous):

C++ is very simmilar to java

OpenStudy (anonymous):

try try try again and again

OpenStudy (anonymous):

that's what I've heard andy

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

lol, they get you excited :)

OpenStudy (anonymous):

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

OpenStudy (anonymous):

ahh outta topic

OpenStudy (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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

Tryptophan puts you to sleep!

OpenStudy (anonymous):

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

OpenStudy (anonymous):

it's in turkey

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (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...)

OpenStudy (anonymous):

but they're using java now

OpenStudy (anonymous):

who?

OpenStudy (anonymous):

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

OpenStudy (anonymous):

everyone

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

They've stopped teaching C++ though

OpenStudy (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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

stupid computer with some human intelligence

OpenStudy (anonymous):

obedient to the rules.

OpenStudy (anonymous):

etc.

OpenStudy (anonymous):

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

OpenStudy (anonymous):

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

OpenStudy (anonymous):

I'll check it later , thanks

OpenStudy (anonymous):

I guess

OpenStudy (anonymous):

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

OpenStudy (anonymous):

:)

OpenStudy (anonymous):

will do

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!