636 Posted Topics

Member Avatar for bletchley

[QUOTE][CODE]#define FERMATH #if[COLOR="Red"][B]n[/B][/COLOR]def FERMATH class Fermat {...}[/CODE][/QUOTE] Your include guards are wrong. What happens here is that the code for class Fermat is only included if FERMATH is [B]not[/B] defined (and of course it is!). Swap the directives at the beginning of the file.

Member Avatar for nezachem
0
127
Member Avatar for choragos

You have to [ICODE]clear()[/ICODE] your stream. When the line ends with the last number, a corresponding extract hits the end of string, and the stream is in end-of-file condition. Calling str() does not clear it.

Member Avatar for choragos
0
349
Member Avatar for fellixombc

He's comparing an int to a pointer at line 18. And assigning a pointer to an int at line 19. Changing double quotes to single quotes (at line 18 and 19) would help.

Member Avatar for fellixombc
0
127
Member Avatar for 3cats

[QUOTE]I've added the 'ofstream output' to the Print_Detail prototype. The error is that the call Print_Detail doesn't take 5 arguments. [/QUOTE] [QUOTE][CODE] input(lettercode, GPA); line 83 getting the error[/CODE][/QUOTE] No. The error is that [ICODE]input[/ICODE] is not a function of 2 arguments. In fact, it is not a function at …

Member Avatar for 3cats
0
223
Member Avatar for MWE_QUE

Irrelevant parts snipped: [QUOTE][CODE]bool enque(QUE *que, void *data) { .... newNode->data = data; ... } int main() { ... char *data; .... for(i = 0; i < strlen(infix); i++) { token = infix[i]; *data = token; enque(que, data); } ... }[/CODE][/QUOTE] The main() passes the same pointer in each call …

Member Avatar for nezachem
0
105
Member Avatar for Iam3R
Member Avatar for Iam3R
0
95
Member Avatar for valorien

Probably, you want to [ICODE]print(value)[/ICODE] instead. PS: note that subprocess.call returns the exit status, not the output. You may want to redirect stdout.

Member Avatar for d5e5
0
3K
Member Avatar for beginnerprogram

Is this a class for computer science, numerical analysis or math.phys.? In any case, the way the assignment is written, you'll need 2 10x10 arrays. Iterate over the "first" storing new estimates in the "second". Compare the "second" values to the "first" using a proper metrics to find out if …

Member Avatar for nezachem
0
303
Member Avatar for nerak19

[QUOTE][CODE] scanf ("%d", A[i][j]);[/CODE][/QUOTE] This is what is wrong (hint: scanf needs an address to scan into).

Member Avatar for nezachem
0
135
Member Avatar for gerard4143

[QUOTE=Aia;1207959][CODE]*(unsigned int*)&recvline[0] = 11111; *(unsigned int*)&recvline[sizeof(unsigned int)] = 22222; /*this section*/ *(void(**)(void))&recvline[2 * sizeof(unsigned int)] = (void(*)(void))&myhello; /*this section*/[/CODE] Casting is not for l-value. Only for r-value.[/QUOTE] Correct, but not applicable. The result of cast, e.g. [ICODE](int *) foo[/ICODE], is not an lvalue, and cannot be assigned. [ICODE](int *) foo …

Member Avatar for gerard4143
1
180
Member Avatar for rai32

[CODE]while(aux=read(sockfd, buffer, 16)!=0)[/CODE] is not doing what you expect it to do. Hint: it assigns aux a result of comparison. One side point: you should not use fgets and fputs (at least not as careless as you do). read and write are better suited for the task. Also, n server.c …

Member Avatar for rai32
0
291
Member Avatar for morteza_ipo
Re: ftp

This is a documented behaviour. FTP.dir() returns None. However, it calls a callback function for each line of the transfer. The default callback prints lines to stdout. You need to provide your own callback.

Member Avatar for nezachem
0
151
Member Avatar for yushuan718

Your code is notified (that is, OnReceive gets called) when it is safe to read. Then, Receive returning 0 means that the peer closed the connection. It may or may not indicate that the download completed. To make such conclusion you must look for the particular headers, primarily Content-Length, Connection, …

Member Avatar for yushuan718
0
98
Member Avatar for icelantic

[QUOTE]stack and queue are also not defined in the scope[/QUOTE] They should be std::stack and std::queue. [QUOTE]q and s are not defined in the scope[/QUOTE] Since stack and queue are not defined, the compiler cannot define s and q as well. The namespace resolution (above) should take care about it.

Member Avatar for nezachem
0
100
Member Avatar for 3cats
Member Avatar for simonsayz27
Member Avatar for abhimanipal
0
140
Member Avatar for vmirz

Your approach indeed doesn't work for non-integer exponents. It is just not applicable. Check out Taylor series, or some other approximation.

Member Avatar for nezachem
0
97
Member Avatar for tcstom

[QUOTE]it is a char array[/QUOTE] You must realize that until you disclosed this vital piece of information all attempts to help were shots in the dark. Now you may try to go with a [CODE]union u { unsigned long SomeLongArray[2]; char SomeCharArray[8]; };[/CODE] which will force the alignment, and avoid …

Member Avatar for tcstom
0
140
Member Avatar for Tops

[QUOTE=firstPerson;1194950]Trace it out. [code] //return T2(12) = 12*2 = 24 def dozen(): return T2('12') [/code] Split it up and analyze it.[/QUOTE] I bet you didn't. (Hint: [ICODE]T2('12')[/ICODE] returns [ICODE]'1212'[/ICODE]

Member Avatar for BestJewSinceJC
0
127
Member Avatar for bongoboia

Clear ISIG and turn off a canonical mode: [CODE]options.c_lflag &= ~(ISIG | ICANON);[/CODE] PS: and please use code tags.

Member Avatar for nezachem
0
162
Member Avatar for tquiva

One thing to add. A straightforward implementation of Taylor series, as in the post #3, quickly leads to numerical problems. A 32-bit integer cannot hold a factorial of numbers beyond 12, which essentially limits the series to the first six members (hence the line 54 of the original post). A …

Member Avatar for jephthah
1
305
Member Avatar for Hatem Faheem

The code has two obvious problems. First, its time complexity is at best quadratic. Second, the randomness is not guaranteed. Given that there are linear algorithms with a true random results (see, for example, [URL="http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle"]shuffling[/URL]), I don't think that this code has any value.

Member Avatar for VernonDozier
0
115
Member Avatar for jeffhorton1965

[QUOTE=Ancient Dragon;1192595]You can't make the return value of that function anything other than an integer. Why? Because they are not normal functions -- it acts more like a self-contained process than another function, except that threads have access to all global data in the entire program. So when a thread …

Member Avatar for jeffhorton1965
0
203
Member Avatar for Extremus

[QUOTE=Extremus;1192778][B]System:[/B] Vista What I want to do is to catch the mouse release event, which I have researched for but nothing useful came up. I found out the way to catch the pressed event: What I want to use it for is to catch the time elapsed between the 'pressed' …

Member Avatar for Extremus
0
1K
Member Avatar for andrew732

I seriously doubt that what you are looking for exists. Your goal is achieved by a combination of an assembler, a simulator, and a debugger (the latter two are usually bundled together). You don't need to modify the simulator code. The process is to assemble your program, load it into …

Member Avatar for andrew732
0
437
Member Avatar for shaftoe

The return value of Parse method has nothing to do with what you return from the start_element handler. The latter, in fact, is ignored. To keep the parsed info, the handler should create an object to keep it, and store the object in the persistent collection. It is a fun …

Member Avatar for shaftoe
0
153
Member Avatar for warlock07

[QUOTE=warlock07;1180974]So here is the algorithm I am trying to design...i'm not sure it will make any sense. I have a sequence of n numbers(in ascending order). I have an another number 'x'. If i have 2 chances to compare x with a number greater than it but unlimited chances to …

Member Avatar for warlock07
0
208
Member Avatar for Excizted

The heap got corrupted somewhere else. Looks like you are using arrays. Make sure there's no overruns, or any other writes beyond the allocated memory, or double deletes, etc, etc, etc. After you find the problem, dump arrays altogether and rewrite everything with vectors.

Member Avatar for Excizted
0
189
Member Avatar for Gonbe

If I understand your problem correctly, I'd just modify the protocol in a following way. Let the connected client, prior to anything else, wait for a "go ahead" from the server. Let the server count the accepted connections. Once the desired count is reached, let the server send that "go …

Member Avatar for nezachem
0
140
Member Avatar for sree_ec

[B]I want to know how my local static variable is in .data segment and my global static is in .bss specifically?[/B] One of them ends up in .data, because it is initialized. Another one ends up in .bss because it is not (or, rather, initialized by 0). [B]and what about …

Member Avatar for sree_ec
0
86
Member Avatar for tquiva

Separate reading digits and constructing a number. Something like [CODE]int get_noisy_digit() { int ch1, ch2; while((ch1 = getchar())!= EOF) { if(!IS_DIGIT(ch1)) continue; if((ch2 = getchar()) == ch1) return ch1; ungetc(ch2); } return EOF; }[/CODE] That said, I doubt the protocol is any good.

Member Avatar for nezachem
0
117
Member Avatar for JJBallanger

[QUOTE=Gribouillis;1088552]A None value is not displayed by the python shell, as in this example [code=python] >>> value = None >>> value >>> [/code] [/QUOTE] [QUOTE=vegaseat;1088677]However this will work in the Python shell ... [code]>>> value = None >>> print(value) None >>> [/code]Looks like the old shell has tripped up a …

Member Avatar for JJBallanger
0
231
Member Avatar for Dwarrel

[QUOTE=Dwarrel;1182125]Hi, i'm trying to learn some assembly, ive got a assignment from school to control a lcd screen. I've got some sample code that i mostly understand but i can't figure out what the SBI command does. Using atmega32, with avr studio 4 [CODE]sbi PortD, LCD_E[/CODE] At this point PortD …

Member Avatar for Dwarrel
0
3K
Member Avatar for habib_parisa

First of all, malloc does not take up a stack. The memory comes from the completely different area. Second, you have to realize that in modern OSes malloc only reserves a range of virtual addresses. A successful malloc does not guarantee that there would be enough physical memory by the …

Member Avatar for jephthah
0
188
Member Avatar for Slobodino

[QUOTE=craig_ka;1180002]Have you tried to do anything yet, I'd like to help but I won't do you program from start to finish. It looks like it could be solved using a 0-1 knapsack with slight modification for the heights changing as you pick. If you post some code you're working/stuck on …

Member Avatar for craig_ka
0
131
Member Avatar for mani_singh

[QUOTE=Ancient Dragon;1180479]>>*(float*) variable = 34; It is typcasting [b]variable[/b] into a float *, then assigning the value 34 [B]to[/B] it. [/QUOTE] Correction: [B]through[/B] it.

Member Avatar for nezachem
0
264
Member Avatar for johndoe444

[QUOTE=johndoe444;1178009][CODE]find . -name 'my*' [/CODE] The quotes avoid the shell expansion - without them the shell would replace my* with the list of files whose names begin with my in the current directory. What thus the above statement mean? Isn't it doing the same thing I mean looking for file …

Member Avatar for Fest3er
0
138
Member Avatar for max.v8

[QUOTE=max.v8;1177993]just run loops to increment their counter[/QUOTE] So far so good. [QUOTE] that would be compared to the integers in the file, so it would be a typical code, like this: [code=c] // NOTE: dato is a pointer to a file for (x=1; x<=100;x++){ freq=0; for ( i=0; !feof( dato …

Member Avatar for max.v8
0
181
Member Avatar for johndoe444

[QUOTE=johndoe444;1177971]from wikipedia: 1. [CODE]find . -name "*.foo" -print0 | xargs -0 grep bar[/CODE] The above command uses GNU specific extensions to find and xargs to separate filenames using the null character; What is the null character? What is the significance of "separate filenames using the null character;"? why should we …

Member Avatar for nezachem
0
158
Member Avatar for trantran

[QUOTE=trantran;1161277] (Also note that the little face in the original example are created automatically by the blog software when I type colon colon asterisk (to indicate data pointer such as : ::*)[/QUOTE] You may consider using code tags, such as [ICODE]::*[/ICODE]. In fact, it is a requirement for this forum.

Member Avatar for trantran
1
565
Member Avatar for AltF4me

Both snippets suffer the same problem. They do not update the one pointer (current->next->previous and current->previous->next respectively). The first snippet gives an impression of working because of the way you traverse the list. Try to traverse it in both directions and you will see the problem.

Member Avatar for AltF4me
0
145
Member Avatar for jephthah

[QUOTE=jephthah;1177175]yeah, i try not to jump between functions, this is just to get out of any single function cleanly in the case of a hardware error. i guess im just soliciting opinions between doing it the first way (with gotos) or the second (without). or another way i havent considered. …

Member Avatar for nezachem
0
136
Member Avatar for petteyg

The code is not portable. It is very linux-specific. It uses termios, and it assumes that stdin is selectable. Another problem is that it doesn't test the select error code. When select returns -1, the fds is undefined, and kbhit would return garbage. Otherwise, it is a fairly standard way …

Member Avatar for petteyg
0
255
Member Avatar for tom384

I doubt you can significantly speed these calculations up by "normal" means. Take a look at SIMD (aka SSE) capabilities of your very good computer.

Member Avatar for nezachem
0
164
Member Avatar for lionaneesh

[QUOTE=lionaneesh;1176969][CODE] printf("Enter word to add: "); fflush(stdin); fgets([COLOR="Red"]word[/COLOR],9,stdin); fflush(stdin); printf("Meaning : "); fflush(stdin); fgets([COLOR="Red"]word[/COLOR],9,stdin); add(word,meaning); [/CODE] what i m trying is to input is two character arrays :- 1. word 2. meaning 1. the program only inputs the meaning and not the word. [/QUOTE] You are reading into the same …

Member Avatar for nezachem
0
157
Member Avatar for AngusFloydKAOS

[QUOTE=AngusFloydKAOS;1175337]Let me see if I can clarify what I want. I want to take a string of numbers (2009-0330) from c and basically have some script variable equal to the same numbers so I can then use these numbers in my script. Does that answer your question?[/QUOTE] Not really. Some …

Member Avatar for nezachem
0
110
Member Avatar for josolanes

[QUOTE=josolanes;1176118] The following is a piece of my dateIOManip.h: [code=cpp] struct fullManip {}; ostream &operator << (ostream &out, fullPtr) { Date::Flags[&out] = "full"; return out; } [/code] -Josh[/QUOTE] Never ever put any definition with global linkage in the include file. An include file may contain only declarations.

Member Avatar for josolanes
0
102
Member Avatar for BestJewSinceJC

[QUOTE=BestJewSinceJC;1176256]I'm trying to write my own system calls. I have a .c file where I'm putting the system calls. My system calls use a struct, so I have declared a global variable that is an array of my struct. Lets just call it [CODE] //Stuff is the name of the …

Member Avatar for BestJewSinceJC
0
96
Member Avatar for johndoe444

Did you look at [URL="http://en.wikipedia.org/wiki/Variadic_macro"]this[/URL]?

Member Avatar for johndoe444
0
118
Member Avatar for patsfan

I don't know what is wrong. You do. Does it not compile? does it crash at runtime? does it not produce the desired results?

Member Avatar for abhimanipal
0
118

The End.