Television | WE GOT LOVE - LIVE [1080P] | Alan Walker

Can someone help me with a program in C? - PC Message Board

Loading...

3DS ANDROID IOS PC PS3 PS4 SWITCH VITA XBOX 360 XBOX ONE MORE SYSTEMS GameFAQs

Log In Sign Up Log In

ANSWERSBOARDSCOMMUNITYCONTRIBUTEGAMESWHAT’S NEW

Search Game Titles

PC » Hardware » Console

PC Home

Games

FAQs

Reviews

Images

Videos

Board

Answers

Can someone help me with a program in C? Topic Archived

Page 1 of 2

Last

You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts. Boards » PC » Can someone help me with a program in C?

Glockass1

#1

4 years ago

Using Dev-C++ Here's my code: #include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int Number(int, int, int); int main(int argc, char *argv[]) { int x, y, z, N, M, result, sum ; sum=0; for (x = -99; x <= 99; x++){ for (y = x; y <= 99; y++){ for (z = y; z <= 99; z++){ result = Number(x, y, z); printf("%d %d %d, %d\n",x,y,z,result) ; if (result == 1){ printf("%d %d %d\n", x, y, z); sum++; } } } } printf("%d total combinations\n", sum); return 0; } int Number(int x, int y , int z){ int a,b,c,d,e; double d1; d = a*a + b*b+ c*c; d1= pow(d,1.0/3); e=(int)d1; if ((d1-e)== 0) { printf("%7.5g \t", d1-e); return 1; } else { printf("%7.5g\n", d1-e ); return 0; }

} For some reason it doesn't work. Here is an example of the result: http://i.imgur.com/IZURYvW.jpg Why does it return 0 all the time? Thanks for the help. Check this image for better viewing: http://i.imgur.com/UrQrriY.jpg --Steam ID: Glockass1 http://i.imgur.com/qsRb7.png http://i.imgur.com/PgA0Rlc.gif

neroAngelo

#2

4 years ago

Ask one of the thousands of C programming boards on the internet. Not a PC gaming board. --PSWii360U - This is how I triforce http://i.imgur.com/9qF9vGa.jpg i7 920 @3.3GHz, 6GB DDR3, 7850 2GB

Ch3wy

#3

4 years ago

It's always returning 0 because d1-e does not equal 0. --How the hell can a octopus live outside of water anyways? This is so stupid. -Fade2black001

Glockass1 (Topic Creator) 4 years ago

#4

Ch3wy posted... It's always returning 0 because d1-e does not equal 0.

I don't think that's it. Even for x=-2, y=0, z=2 it should be 1 but it's not. --Steam ID: Glockass1 http://i.imgur.com/qsRb7.png http://i.imgur.com/PgA0Rlc.gif

Ch3wy

#5

4 years ago

Have you tried using cbrt(d) instead of pow(d,1.0/3)? --How the hell can a octopus live outside of water anyways? This is so stupid. -Fade2black001

Ch3wy

#6

4 years ago

Wait a second you never even set the values for a, b, and c. --How the hell can a octopus live outside of water anyways? This is so stupid. -Fade2black001

popping4it

#7

4 years ago

Ch3wy posted... Wait a second you never even set the values for a, b, and c.

ya that looks like the problem should be. in line 31 d = x*x + y*y + z*z or prior ... a = x b = y c = z --whens mahvel?

Glockass1 (Topic Creator) 4 years ago

#8

popping4it posted... Ch3wy posted... Wait a second you never even set the values for a, b, and c.

ya that looks like the problem should be. in line 31 d = x*x + y*y + z*z or prior ... a = x b = y c = z

lol that was the problem I think. I got confused because I thought they get values automatically. Thanks for the help. Also, is there a way to make the program faster? It takes a while to go through all the combinations. --Steam ID: Glockass1 http://i.imgur.com/qsRb7.png http://i.imgur.com/PgA0Rlc.gif

popping4it

#9

4 years ago

if the goal is to output all the combinations it has to run through x^3 no matter what. its likely the pow function is what ends up taking the most time. --whens mahvel?

Ch3wy

#10

4 years ago

There might be a chance that cbrt is faster than throwing a fraction into pow, but I'm not sure. Worth a shot. --How the hell can a octopus live outside of water anyways? This is so stupid. -Fade2black001

Boards » PC » Can someone help me with a program in C? Topic Archived

Page 1 of 2

From The Web

Last

Promoted Links by Taboola

If You're Over 30 And Own A Computer, This Game Is A Must-Have! Throne: Online Strategy Game

Open a bank account right from your living room N26 - The Mobile Bank

Journey through the Ages in this Award-Winning Game Forge of Empires - Free Online Game

Triplets Take DNA Test But Drs Reveal Painful News LikelyThings

Next generation MOSFET technology takes on the challenges of the automotive sector Toshiba Innovation

Dragon Ball FighterZ DLC Season Pass Announced, Adds 8 New Playable Characters

How To Unlock Monster Hunter World's Horizon Zero Dawn Armor Sets

Monster Hunter World's PS4-Exclusive Horizon DLC Available Right Now For A Limited Time

More topics from this board... Hows Kerbal Space Program?

refmon

5

4/8 1:09AM

New Humble Monthly live. Dead Rising 4, Kerbal Space Program and Ruiner headline

BMXJouster

20

4/7 9:35PM

Got a GTX 770,which graphic card would be a huge upgrade that isn't a top card?

Oakland510_

13

4/9 11:51AM

A quick question need answer fast please i am off the way imprezas to buy a gpu now

8

4/11 8:31AM

I want to turn a PC into a dedicated media streaming server

3

4/12 4:55PM

spike_spiegel

facebook.com/GFAQs gamespot.com

twitter.com/GameFAQs

giantbomb.com

Help / Contact Us

metacritic.com

Change Colors

gamerankings.com



Sitemap

Advertise

Partnerships

Careers

Privacy Policy

Ad Choice

© 2018 CBS Interactive Inc. All rights reserved.

Terms of Use

Report Ad

Loading...

Can someone help me with a program in C? - PC Message Board

3DS ANDROID IOS PC PS3 PS4 SWITCH VITA XBOX 360 XBOX ONE MORE SYSTEMS GameFAQs Log In Sign Up Log In ANSWERSBOARDSCOMMUNITYCONTRIBUTEGAMESWHAT’S NEW...

186KB Sizes 2 Downloads 4 Views

Recommend Documents

Can someone please help me with SPANISH? – askhold.club
Fill the blank with the preterite form of the verb in parentheses. Nosotros la carta al correo. (traer). 2. Fill the bla

Can someone please help me with this accounting question? | Yahoo
Jun 23, 2013 - Problem 9-2A Accounts receivable transactions and bad debts adjustments L.O. C1, P2 Lopez Company began o

Someone help me with Spanish homework? (Book: Descubre 1)? | Yahoo
Jan 13, 2011 - hey, i'm a native spanish speaker. i don't have that book, but i'll gladly give help you with the answers

please help me someone,please - CanadaVisa.com
Nov 28, 2017 - yesterday my visa got rejected from cambrian college and i am again applying for may intake from fanshawe

Hi,someone can help me with these questions of Physics,I will gave
1-A car traveling at a speed of 30m/s encounters an emergency and comes to a complete stop.How much time will it take fo

Can An Expert Provide Me With Nursing Assignment Help?
The nursing assignments are very important for the nursing students in the nursing institutions. The professors give the

Can someone help me Mimic the 3 Fund Portfolio (Total Stock, Inter
19 Feb 2016 - You can, however, invest in other Voluntary Investment Plan investment options in addition to or instead o

Can someone give me some examples of investigatory projects that
Using step-by-step visual instructions & detailed theory manual, you can make your physics investigatory project within

a program for a super market! - C Board - Cprogramming.com
Nov 7, 2011 - Suppose you have to develop a program for managing the sales of your grocery store. The following function

Can Someone Write A Song For Me, Professional Writing Service in
You can block someone to prevent them from seeing things you post on your profile, starting conversations with you or ad