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