[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Programming in C. Help.

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 17
Thread images: 2

File: Capture.png (99KB, 617x628px) Image search: [Google]
Capture.png
99KB, 617x628px
Hi guys i need help making a simple program.

if anybody can give me hints on how to make the main function i would really appreciate it.

The Program MUST BE WRITTEN IN C

also i cant use pointers.

Please Help me.
>>
>>57079214
Dude seriously, why are you even taking computer science?

I swear to God I hope they fucking deport you back to whatever shit-hole country you are from.
>>
>>57079302
Country I'm From America.
Why I'm taking this course, cuz I'm forced to.
Never actually taken anything like it before but as a Chem.Eng. I never thought i would use it.

Please help.
>>
Bait
>>
install gentoo
>>
>>57079337
I'm not baiting. I really need help.

somebody please help.

I really need help with the main function.
>>
This shit is posted literally every single night and you faggots still respond to it
>>
Look through this to give you an idea, I suppose.

http://math.stackexchange.com/questions/1274816/numbers-that-can-be-expressed-as-the-sum-of-two-cubes-in-exactly-two-different-w
>>
>>57079214
You probably need math help, not programming help. The actual programming is simple once you understand how to calculate it.

Read up on this.
http://math.stackexchange.com/questions/290635/algorithm-to-find-the-numbers-expressible-as-the-sum-of-two-positive-cubes-in-tw

>also i cant use pointers.
you don't need pointers
>>
>>57079371
i posted it two nights ago, but i was given a response with pointers, so i couldn't really understand it.
>>
File: 1405034392301.gif (2MB, 278x166px) Image search: [Google]
1405034392301.gif
2MB, 278x166px
>>57079354
bruh
>>
If you can't even see the naive and inefficient solution, you're not cut out to be a programmer. This is not even a programming question, this is an algorithms question. It's like going into a cooking class and asking what food is.
>>
>>57079396
bait
>>
I didn't want to think too hard so here's something that runs in O(n^2) time instead of something better that would run in O(n) time.
#include<stdio.h>
int main() {
int n, i, count=0, j, k, int_count;
printf("Enter the number of values needed: ");
scanf("%d", &n);
i = 1;
while(count < n) {
int_count = 0;
for (j=1; j<=((int(pow(i, 1.0/3)); j++) {
for(k=j+1; k<=((int(pow(i,1.0/3)); k++) {
if(j*j*j+k*k*k == i)
int_count++;
}
}
if(int_count == 2) {
count++;
printf("\nGot %d Hardy-Ramanujan numbers %d", count, i);
}
i++;
}
}
>>
>>57079395

>>57079374

I'm able to visualize the arithmetic but the issue is putting it in code...
>>
Google is your friend. Decide if you can brute force it or if you need an elegant solution.

http://stackoverflow.com/questions/11410798/finding-taxicab-numbers

1. Accept input
2. Calculate cubes for integers 1 through N
3. Calculate sums of all cubes and store any hits.

Should be fine unless the professor has a complexity clause because this is probably O(n)^3 and if you're running this on shit hardware you might have memory problems.

Start from there and then meet with your professor, he can suggest more intuitive algorithms.
>>
>>57079214
from the sticky:
> /g/ is NOT your personal tech support team or personal consumer review site.
also, there is >>>/g/dpt
Thread posts: 17
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.