Forum: C Dec 24th, 2005 |
| Replies: 2 Views: 1,032 |
Forum: C Dec 22nd, 2005 |
| Replies: 27 Views: 4,064 |
Forum: C Dec 15th, 2005 |
| Replies: 3 Views: 1,160 Re: Link List Move Method What is wrong with using the functions you already got
void Sequence::move(int from, int to)
{
SeqItemType item = find( from )->item ;
remove(from) ;
insert( to, item ) ;
} |
Forum: C++ Dec 15th, 2005 |
| Replies: 4 Views: 1,240 Re: Doubts in C Q1: Alternative 1
Q2: If the function X returns an integer, uses standard calling convention (and possibly is not dynamically linked, I'm not sure about the actual meaning of... |
Forum: C++ Dec 15th, 2005 |
| Replies: 4 Views: 978 Re: C in my PC Well here is as modern as you are like to get, and all free
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx |
Forum: C Dec 14th, 2005 |
| Replies: 4 Views: 1,410 Re: initializing a hash_set ? Yes, hash_map is probably the correct thing to use in this case...
Hmm, one problem is you are using different types, that iterator is not neccecarily the same as the one returned (might work... |
Forum: C Dec 14th, 2005 |
| Replies: 4 Views: 1,410 Re: initializing a hash_set ? Template arguments are <class _Value, class _HashFcn, class _EqualKey, ... >
You probably only need to redifine _HashFcn thought...
struct newHashFnc
{
size_t operator(const Point3D &p3d)
{
... |
Forum: C Dec 14th, 2005 |
| Replies: 15 Views: 2,391 Re: Memory Leak? Where do you find such exception information? It should be written down somewhere on msdn like most error codes I guess (link please)?
(I've already explained the difference, if you do not want to... |
Forum: C Dec 14th, 2005 |
| Replies: 15 Views: 2,391 Re: Memory Leak? Well thats windows for you... unkown software exception... sugestion: debug program to try to get a full stack trace of where the exception occurs. |
Forum: C Dec 14th, 2005 |
| Replies: 15 Views: 2,391 Re: Memory Leak? But what does the exception say ? (In (win32) c you hardly get exceptions unless its fatal, such as dereferensing a null pointer, or running out of memory)... |
Forum: C Dec 13th, 2005 |
| Replies: 1 Views: 769 Re: Trying to understand this code??? Try reading up on quicksort in general... The loop (lines 2-9) make sure that all the low values are in one range and the high values in the other... The recursive calls (lines 10,11) then does the... |
Forum: C Dec 13th, 2005 |
| Replies: 15 Views: 2,391 Re: Memory Leak? As I said char pBuf = char[1000025]; is syntax error and does not mean anything...
char pBuf[10000025]; mean declare as local variable and store on stack
char *pBuf = new char[10000025]; mean declare... |
Forum: C++ Dec 13th, 2005 |
| Replies: 3 Views: 949 Re: File I/O Question ofcourse, there is plenty of ways to do this... you could for example store the previous value...
current_value = file.getc() ;
if( current_value == 'j' && previous_value == 'j') {
// We got our... |
Forum: C Dec 13th, 2005 |
| Replies: 15 Views: 2,391 Re: Memory Leak? I suppose you mean char pBuf[LARGE_INTEGER_VALUE], the usual problem with that is you easily get stack overflow due to restrictive stack memory allocation, even if I doubt you need such a large... |
Forum: C++ Dec 13th, 2005 |
| Replies: 3 Views: 949 Re: File I/O Question switch only operate on a single integer value... however since a char is smaller than an integer I suppose you could stack it in one value and then do the switch
value = ((value << 8) & 0xff)... |
Forum: C Dec 13th, 2005 |
| Replies: 15 Views: 2,391 Re: Memory Leak? Because you dont release the memory ? (There is no delete matching the new)... (However most implementations of delete would not actually return the memory to the system anyway, it would just put it... |
Forum: C++ Dec 10th, 2005 |
| Replies: 4 Views: 2,047 Re: Replacing strings that are not case sensitive Sugestion: Use regex, produces just about the fastest searches possible (you need a external library thought, I doubt it comes included in vc++ atleast I havent seen it, boost.org is one good source). |
Forum: C++ Dec 10th, 2005 |
| Replies: 7 Views: 1,510 Re: Some thingthat we can do in C and Not in C++ Aha... implicit function declarations ! Rather weak thought, but it feels the same as saying something that can not be done in c but in c++, both are complete turing machines and can as such do... |
Forum: C++ Dec 10th, 2005 |
| Replies: 3 Views: 944 Re: complex declarations & other doubts 1)
Just work your self out from the middle, if they are given in k&r they describe them in k&r ?
char(* (*f())[]) ()
*f() => f is function pointer taking zero arguments
returning (* ... [])() =>... |
Forum: C++ Dec 7th, 2005 |
| Replies: 3 Views: 1,825 Re: C++ to ASM IANAAP (I Am Not An Assember Programmer) but, some thoughts:
Feels like there is as many ways to write assembler as there are assemblers thought... What is the problem ?
Argh, whats up with the k... |
Forum: C Dec 7th, 2005 |
| Replies: 2 Views: 978 |
Forum: C Dec 7th, 2005 |
| Replies: 9 Views: 1,864 Re: Trouble with Pointers and Arrays if you were to do printf("%p == %p ?\n", changingString, msgs[numMsgs] ) You would find that both pointers are identical... Either create a new string and copy the value over
msgs[numMsgs] = new... |
Forum: C Dec 7th, 2005 |
| Replies: 9 Views: 1,864 Re: Trouble with Pointers and Arrays delete what?
(this should work, included some possible errors I could think of)
vector <char*> constArray(10);
char* changingString = "hello";
delete constArray[0] ; // error, not... |
Forum: C Dec 7th, 2005 |
| Replies: 6 Views: 1,215 Re: Algorithms checking There is something called formal programming or something similar that enables you to state post and preconditions allowing you to "prove" that your code does what you say it does (might have been... |
Forum: C Dec 7th, 2005 |
| Replies: 9 Views: 1,864 Re: Trouble with Pointers and Arrays Well you got a strange compiler, mine outputs hello, hi...
the constArray[0] points to the static string "hello", if you want to point at the pointer pointing to hello you gotta do &p...
allocating a... |
Forum: C Dec 6th, 2005 |
| Replies: 6 Views: 1,215 Re: Algorithms checking Saying perhaps it is and the can, but me does not understand
(courtesy of our favorite translator babelfish)... |
Forum: C Dec 6th, 2005 |
| Replies: 4 Views: 1,571 |
Forum: C++ Dec 6th, 2005 |
| Replies: 2 Views: 745 Re: help! Well the only book I read is Introduction to Data Compression, it contains a couple of chapters on Text compression... However this is mainly theoretical, and probably more use for understanding than... |
Forum: C Dec 6th, 2005 |
| Replies: 4 Views: 1,571 |
Forum: C++ Dec 6th, 2005 |
| Replies: 11 Views: 1,787 Re: wrong output Well then, thanks for including algorithm, I had a feeling it could be done but I did not feel like adlibbing it... (I assume it is correct even if it looks a little odd at times, may be smart... |
Forum: C++ Dec 5th, 2005 |
| Replies: 11 Views: 1,787 Re: wrong output Thoughts:
case ')': Should probably output all ops untill a '(' is found on the stack.
The Big if statement on operators should probably be broken up, empty and '(' cases looks correct, but... |
Forum: C++ Dec 5th, 2005 |
| Replies: 11 Views: 1,787 Re: wrong output Well I have been thinking about this one, I _could_ make a full parser (which would essentially parse the full expression tree and the spit it out after some tinkering)... however this solution you... |
Forum: C++ Dec 5th, 2005 |
| Replies: 11 Views: 1,787 Re: wrong output Well it does not output numbers since you dont print them (obviously) currently whenever a number is encountered the switch statement will fall through to the output stackopt statement producing the... |
Forum: C++ Dec 5th, 2005 |
| Replies: 6 Views: 2,081 Re: Beyond C++ console program.. I have been stuck in your corner for quite a while, guess I ran out of time... I also recommend that first book since it will tell you what all those classes in MFC does, really...
(Saw an example... |
Forum: C++ Dec 5th, 2005 |
| Replies: 11 Views: 1,787 Re: wrong output These things are more easily done using yacc and bison... I have a vague recollection about some statements of implementability of these types of grammar on a stack based machine so I suppose it... |
Forum: C Dec 5th, 2005 |
| Replies: 4 Views: 1,234 Re: array struct display?? man is your saviour, do man qsort or get your libc.hlp from devcpp if you are on win...
for a struct of type
struct tuple {
char artist[50];
char album[50];
char label[50];
int year[4];
char... |
Forum: C++ Dec 4th, 2005 |
| Replies: 10 Views: 1,620 Re: Cryptology Short note, since you seem to have io well in hand just do man fopen and you will have what you need... (You can use the same functions for files as for standard input/output if you have a FILE*... |
Forum: C Dec 3rd, 2005 |
| Replies: 3 Views: 1,117 Re: Ruby Language A somewhat odd introduction to ruby... (an interpreted language, with features comparable to python, or so I've heard).
http://poignantguide.net/ruby/ |
Forum: C++ Dec 3rd, 2005 |
| Replies: 3 Views: 997 Re: Please someone help me bool Siblinb::operator<( const Sibling &other )
{
return age < other.age ;
}
...
#include <algorithm>
...
std::sort( siblingobj, siblingobj + num_siblings ) ; |
Forum: C Dec 2nd, 2005 |
| Replies: 2 Views: 971 Re: sort in unix--help Lol, so now I'm not an expert on linux utilities but I enjoy tinkering with it now and then... This is one way to solve _this_ problem, somehow I thought it would be possible to use the -k flag for... |