89 Posted Topics

Member Avatar for Banfa

[QUOTE=abhimanipal;1222615] Yes after 7 the code will indeed produce 9 and 9 is not a prime number. But the input number will never be divisible by 9. So if the input is 27, the code will divide it first by 3 to get 9 and then again by 3 to …

Member Avatar for 0x69
3
308
Member Avatar for albruno

Also if you are interested not only in CUDA, but in GPU processing in Python,- you could look also here- GPU image processing- [url]http://www.cs.lth.se/home/Calle_Lejdfors/pygpu/[/url] General purpose GPU computing through OpenCL- [url]http://mathema.tician.de/software/pyopencl[/url]

Member Avatar for 0x69
0
139
Member Avatar for AndrewYY
Member Avatar for 0x69
0
3K
Member Avatar for tcotto

[CODE=C] #define TRUE 1 // init composite[i] to zero void FindPrimes(int composite[], int until) { for (int i = 2; i < until; i++) { // if number i is not composite number or in other words - if it is prime number if (!composite[i]) { // find out all …

Member Avatar for 0x69
0
104
Member Avatar for Xomy

Please post code with code tags... It's hard to notice something without code tags. Ok, now about code. Here is some redundant code here: [CODE=C#] //If depth charge dropped and ship is facing right... if(_drop && ship.FlipHorizontally == false) { X = ship.X - 50; Y = ship.Y; Angle = …

Member Avatar for Xomy
-1
224
Member Avatar for brightsolar

What you mean by saying that - [QUOTE]Or help me create a collision between my squares in some way.[/QUOTE] Are you trying to implement collision detection ? If yes - try looking in google, there are plenty of sites on that subject, for example- [url]http://www.gamespp.com/algorithms/collisiondetection/[/url] If no,- I don't understand …

Member Avatar for 0x69
0
205
Member Avatar for 0x69

I have interesting question. Why this code is legal in C, but not legal in C++ ? (tested with GCC 4.2 compilers) [CODE=C] void Function() {} int main () { Function(1); return 0; } [/CODE] We can simulate same C++ compiler error in C compiler by changing function definition to …

Member Avatar for 0x69
0
660
Member Avatar for lvhvaraprasad

Hey man, you need to do homeworks yourself. But given that your mentioned problem is interesting NP problem,- i'll give you small pseudocode snippet: [CODE=C] #define OP_NOT 1 #define OP_AND 2 #define OP_OR 3 int bool_formula[6] = {OP_NOT,0,OP_AND,0,OP_OR,0}; int bit_pattern = -1; char x1,x2,x3; int is_formula_satisfiable = 0; WHILE (bit_pattern …

Member Avatar for 0x69
-7
178
Member Avatar for bobyx

Error messages are pretty straightforward - non-reentrant library code can't be executed in the same time by several threads (2 threads in this case). You must use semaphores (mutex) to lock shared resources between threads in such a way, that shared resource is accessed by only 1 thread at a …

Member Avatar for 0x69
0
2K
Member Avatar for sourabhtripathi

[QUOTE=sourabhtripathi;1212221]how shd i do only declaration then !! extern int a; ??? is this right !![/QUOTE] Yes. [ICODE]extern[/ICODE] keyword tells to compiler that variable 'a' is defined somewhere else, i.e. with 'extern' we only do declaration of variables. And [ICODE]Definition = Declaration + Memory allocation + Initialization (sometimes)[/ICODE],- such as …

Member Avatar for 0x69
0
116
Member Avatar for dyladalyla

From my point of view, actor is entity, which: 1. Initiates actions in the whole system 2. Is outside of any system In this point of view, you are using too much actors here. So that the *real* actor maybe only web user. The rest - should be system-system interaction …

Member Avatar for RobertGrabe
0
578
Member Avatar for koved

[QUOTE=koved;1212935]i want to know what is the code written in header files.(how a functions works) is that possible for e.g. i created my own version of [U]sqrt[/U] function in .C now i want to know the difference b/w my code and sqrt function code. i want to check how efficiently …

Member Avatar for 0x69
0
81
Member Avatar for qwerty_touch

[QUOTE=qwerty_touch;1206656]Hello, this forum is for asking the required code and logic behind implementing the "factorial program - i.e. finding factorial of any big number"---could someone help me out???/[/QUOTE] Reduce problem into 1. saving big number as array of digits 2. multiplication of 2 given number's in array format After implementing …

Member Avatar for 0x69
-1
160
Member Avatar for martinjcloud

Word shuffling pseudocode: [CODE] For earch word in sentence: Random_word1 = Random word from [1..WordCount] Random_word2 = Random word from [1..WordCount] Switch_words(Random_word1, Random_word2) [/CODE]

Member Avatar for jephthah
0
130
Member Avatar for a1eio

[QUOTE=a1eio;162182]So i'm just wondering, if anyone has any experience or knows of a good BEGINERS guide or tutorial (paper whatever you call them) on Artificial Intelligence thanks peeps[/QUOTE] Personally I prefer book - [url]http://www.amazon.com/Artificial-Intelligence-Systems-Approach-Computer/dp/0763773379/ref=sr_1_1?ie=UTF8&s=books&qid=1272306013&sr=1-1[/url] It is kind of pragmatic/practical approach to AI field. Also has many C code examples. Has …

Member Avatar for rico001
-1
278
Member Avatar for blackmagic01021

[QUOTE=blackmagic01021;1202621]I understood that 0x80000000 is the minimum value for the 32 bit integer for 32 bit machine. If I want the same value for 64 bit machine, what will be the value? Please explain.[/QUOTE] 0x80000000 /in decimal -2147483648/ is minimum value of signed 32-bit integer 0x0 /in decimal also 0/ …

Member Avatar for Rashakil Fol
0
128
Member Avatar for dumpstercake

"Reflection" is unknown beast to me. But i am a bit familiar with some biologically inspired classic methods,- such as genetic algorithms, evolution strategy optimization method, neural networks, cellular automaton. For classics you can start from here (huh, maybe you know already this ?), anyway- [url]http://en.wikipedia.org/wiki/Biologically_inspired_computing#Areas_of_research[/url]

Member Avatar for 0x69
0
78
Member Avatar for Hidden_mistakes

Hey, bounding-boxes is most simple collision detection method. What you didn't understood in that gamedev code exactly ? Ok. If you want even MORE simple collision detection you can use this- circle-circle collision method. Collision will be when: [ICODE]d <= r1 + r2[/ICODE], here d -> distance between circles centers. …

Member Avatar for 0x69
0
78
Member Avatar for teenybopper

[QUOTE=teenybopper;1185620]I need to write a program, which shows the different combinations in which matrices can be multiplied. The output should look like below : When there are two matrices multiplied there is one combination (XX) When there are three matrices multiplied there are two combinations (X(XX)) ((XX)X) When there are …

Member Avatar for jwenting
0
90
Member Avatar for ruigrandaorocha

you can try something with loop, kind of: [CODE] scanf("%d", &k); for (int i=0; i<k; i++) { printf(" "); scanf("%d", &k_number); } [/CODE]

Member Avatar for ruigrandaorocha
0
189
Member Avatar for calccrypto

There is no such reduction formula which could map hash to it's input value. As such all reduction formulas *maps* hash to any value randomly, with the hope that at some iteration reduction formula will accidentally point to good password (aka. input to hash). So this is just probabilistic algorithm. …

Member Avatar for 0x69
0
862
Member Avatar for nunos

No need to store "bad" sequences at all. Backtracking algorithm skeleton is simple. Pseudocode: [ICODE] int queen_positions[8] queen_index = -1 goback = false While(NOT_SOLVED) { if not goback { queen_index++ } queen_positions[queen_index] = next legal position from [1..64] if no_legal_position_for(queen_index) { queen_index-- goback = true } else { goback = …

Member Avatar for 0x69
0
128
Member Avatar for manutd4life

[QUOTE=manutd4life;1189558]here's my question: write a program that asks the user to type the value of N and writes this picture : N=1 * N=2 ** * N=3 *** ** * [/QUOTE] [code=c]#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int numOfStars = 0; do { // it is …

Member Avatar for manutd4life
0
172
Member Avatar for ilkeamasya

[QUOTE=ilkeamasya;1196884] What's more, i can not print the information by this command: [CODE]printf ( "%d %s %s %d %d %d %d", &info[i].number, info[i].name, info[i].surname, &info[i].midterm, &info[i].final, &info[i].hw1, &info[i].hw2 );[/CODE] Where may the problem be?[/QUOTE] printf expects parameters, not addresses to them,- so remove '&' from arguments to printf.

Member Avatar for ilkeamasya
0
250
Member Avatar for setmenull

It's hard to say - if impossible at all - what language may be essential for your carrier. It totally depends... on your future job profile. Besides i can almost guarantee that you will not learn in university/college such things that will be needed by your future employer. So you …

Member Avatar for Nick Evan
0
432
Member Avatar for tquiva

[QUOTE=tquiva;1193809]But why am I getting a cosine value of 2.4653 for an input of 2?[/QUOTE] As jephthah explained - that is a property of Taylor series approximation. If you want some continuous approximation (which doesn't have increasing error) then you must use some other polynomial approximations - for example by …

Member Avatar for jephthah
1
305
Member Avatar for Pynolathgeen

It's more interesting to me How you pass objects for collision detection routine ? I'm asking because routine for choosing which objects to pass into [CODE=c] int Collision(CHARACTER* object1, CHARACTER* object2) [/CODE] this function also very important for perfomance issues. It can be that it is more important than collision …

Member Avatar for Pynolathgeen
0
136
Member Avatar for raymyster
Member Avatar for 0x69
0
148
Member Avatar for DavidDD

In my opinion I at first tried to implement new ball speed as superposition of ball speed and paddle speed. In vector form it would be: [CODE]V_ball_new = V_ball + V_paddle[/CODE] Results should be interesting too. Good luck.

Member Avatar for 0x69
0
85
Member Avatar for demicin

[QUOTE=demicin;1190136]how does the propositional logic and set theory support computing? answer for me this question.[/QUOTE] Is it so hard to find relation between set theory and databases ?

Member Avatar for jwenting
0
70
Member Avatar for warlock07

I would use such algorithm => --------------------------------------------------- index(n) = index(n-1) + K(n) ; K(n) = K(n-1)*C; speedUp = (x-numberAt(index(n-2))) / (x-numberAt(index(n-1))); when speedUp < MaxSpeedUp then C = SpeedUpFactor when speedUp = MaxSpeedUp then C = 1 when speedUp > MaxSpeedUp then C = 1/SpeedUpFactor ; MaxSpeedUp = 2; SpeedUpFactor …

Member Avatar for warlock07
0
208
Member Avatar for Muhammadlodhi

I can only say hints: 1. Use [CODE]char* token=strtok(string,"()")[/CODE] to read tokens from expression. 2. Use [CODE]sscanf(token,"%d%c%d",&arg1,&operator,&arg2)[/CODE] to read int's and operator character from token. 3. Write [CODE]switch(operator) {/*case by operator type*/}{[/CODE] and perform arithmetic actions on these arg1, arg2 variables. 4. Construct new string composed of old one but …

Member Avatar for Adak
0
151
Member Avatar for pramoda.ma
Member Avatar for Ancient Dragon
0
5K
Member Avatar for LMat619

[QUOTE=LMat619;1185556] All I need to do now is make a loop to check if two+ guests have the same bday and have it return 1 or 0.[/QUOTE] I optimized a bit calculation of duplicates - main idea is that when guest count is less than 365 -> we should iterate …

Member Avatar for WaltP
0
249
Member Avatar for thriek

You can start from here-> [url]http://en.wikipedia.org/wiki/List_of_game_engines#Free_.2F_open_source_engines[/url] But if you *really* want to try your game programming abilities -> grab C++ compiler (preferably Visual Studio), grab DirectX SDK and maybe some 3D free modeling tool (such as Wings3D) and just start coding some simple game such as tetris or maybe some …

Member Avatar for baune
0
166
Member Avatar for ITgirl2010

should be something like this: [CODE] #bla bla bla if BMI < 19: print " You are currently underweight" elif BMI >= 19 and BMI <= 25: print " You are in a healthy weight range" elif BMI > 25 and BMI < 30: print " You are now overweight. …

Member Avatar for ITgirl2010
0
214
Member Avatar for vino4all

[QUOTE=vino4all;1184841]I'm getting 1 12 345 6789 by using the following code. Help me to get the expected code. [code=c] #include <stdio.h> #include <conio.h> int main() { int i,j,m=0; clrscr(); for (i=0;i<4;i++) { for(k=1;k<=31-i;k++)printf(" "); if(i==0) // use space here printf(" 1"); else for (j=i+1;j>=1 ;j-- ) { m=m+1; // and …

Member Avatar for 0x69
0
369
Member Avatar for ssDimensionss

use something like this: [CODE] #include <stdio.h> #include <math.h> #define sign(x) ((x>0.0)-(x<0.0)) double roundup(double val) { double fracp, intp; fracp = modf(val , &intp); return intp+((fabs(fracp) >= 0.5)? sign(fracp):0); } int main () { printf("%lf rounded to %lf\n",2.15,roundup(2.15)); printf("%lf rounded to %lf\n",2.55,roundup(2.55)); printf("%lf rounded to %lf\n",-2.15,roundup(-2.15)); printf("%lf rounded to %lf\n",-2.55,roundup(-2.55)); …

Member Avatar for 0x69
0
6K
Member Avatar for evansjahja

I bet that you want to use power function instead of XOR operator, something like: [CODE] #include <math.h> float key_magic = pow(2., 1./12.); [/CODE]

Member Avatar for 0x69
0
3K

The End.