6,741 Posted Topics
Re: First and foremost, don't ever use Robert Sedgewick's code. He knows his stuff when it comes to algorithms, he's a smart guy, and I recommend his books wholeheartedly for the descriptions and insights. But his code sucks ass! It's poorly written and often contains subtle or not so subtle bugs. … | |
Re: Both. I use Mandrake, FreeBSD, and Windows XP as my three primary systems. I also occasionally find myself working with HP-UX, various other versions of Windows, SUSE, Solaris, and MacOS. | |
Re: >Is new keyword in C No, it's just a variable. >and what about this? The author is telling you the steps for splicing a new node onto the front of a linked list. | |
Re: >What is your view or experience with this issue? Linux and Unix users tend not to run as a super user. Windows users almost always run as an administrator. The security debate is already skewed in favor of Unix/Linux because if you don't run as a super user, you've effectively … | |
Re: Find out the integer value of the character in your character set and you can use the hexadecimal or octal escape characters: [code=cplusplus] #include <iostream> int main() { std::cout<<"A == \x41, A == \101\n"; } [/code] | |
Re: >why did i need the std:: before i cout Because every standard name is now placed inside the std namespace. To access one of those names, you have to get into the std namespace in one of three ways: The using directive to open up all names within the scope: … | |
Re: >i always mix up a NULL and '\0' and 0. The short answer is that you use NULL with pointers, '\0' with characters, and 0 with everything else. The long answer is that '\0' and 0 are identical. In C they're both integers with the value 0. You can use … | |
Re: The documentation will be your best bet for learning your particular implementation. For learning C++, you would be wise to stick to books that follow the standard language closely. "Accelerated C++" is a good choice. | |
Re: >NO LOOPS!!!!!!!! RECURSION ONLY! no FOR no WHILE....FORBIDDEN or the grade will be 0! Uh, I think we get it. You can't use loops. There's no need to go overboard. >Thanx a lot......... Well, you're not going to get any help unless you show some proof of effort. Post your … | |
Re: The answer is yes. If the function is virtual, you can redefine it in Pigeon to do something different: [code=cplusplus] #include <iostream> class Bird { public: virtual void Amethod() { std::cout<<"Amethod from Bird\n"; } }; class Pigeon: public Bird { virtual void Amethod() { std::cout<<"Amethod from Pigeon\n"; } }; void … | |
Re: What are you going to do with the contents of the file? How big is it? | |
Re: Here's a hint. Given a character that represents a digit, you can subtract '0' from the character and get the digit value. '0' - '0' is 0, '1' - '0' is 1, etc... With that you can use this expression to build an integer value from a sequence of character … | |
Re: >Would a text file be the most professional way to save the settings for an executable? Why wouldn't it be? If you don't need anything more sophisticated it would be unprofessional to push more of a solution than you require. >So, what kind of file is IE7 or most mainstream … | |
Re: >Just wondering whats the difference between a Programmer and a Developer? The difference is how you label them. In theory a programmer doesn't do any of the designing for a project; he's strictly a code monkey. A developer is active in all stages of the development of software. In reality … | |
Re: >But, can we just add a feature so that after a certain >amount of time, the thread is not deleted, but it is closed? There's really nothing wrong with re-opening a discussion as long as it's relevant. The problem is bumping ancient threads with a "me too!" post, or to … | |
Re: >or it is suppose to be already included by the Windows.h header file? Headers only contain declarations. To get the definitions you need to link with a library (ie. Kernel32.lib or Kernel32.dll). Here's a poor man's timer: [code=c] #include <stdio.h> #include <time.h> void wait ( double seconds ) { clock_t … | |
Re: >Could someone recommend a C++ compiler to write programs on a linux platform. [url=http://gcc.gnu.org/]GCC[/url]. It's probably already installed on your computer, too. | |
Re: Um, upper symmetry? Would you care to define that for us? | |
Re: >Ancient Dragon, sizeof(int *) and sizeof(int) just gives 4 bytes. On your machine. >That makes size since all memory location are 4byte long, well on 32 but machine. That's certainly a logical assumption. >Am i right? No, you're not. A pointer in C doesn't apply to any specific implementation, it … | |
Re: >I need to convert a variable of single character to corresponding ASCII number. First, keep in mind that the world doesn't run on ASCII anymore. However, the char data type is also an integer type, so you can simply treat it as an integer and the problem is solved: [code=cplusplus] … | |
Re: What have you done so far to solve this problem? | |
Re: Hmm, close. >void (*ptr)(); Pointers to member functions have different syntax than pointers to functions. You need to specify the class: [code=cplusplus] void (A::*ptr)(); [/code] >ptr = &a.show; Member functions aren't stored internally in objects. You need a class resolution for this: [code=cplusplus] ptr = &A::show; [/code] >*ptr(); Non-static member … | |
Re: A more detailed answer is that C doesn't really have a string type. Because there's no string type, we use arrays of char with a special character acting as the end of the string, and all of the rules for arrays apply. In other words, arrays aren't a first class … | |
Re: >I need help to complete this program together with the interface What [b]exactly[/b] do you need help with? Your posts reek of a "do it for me!" attitude. | |
Re: >do you also think that something should be done about >those who give out neg rep which was uneccesary? What do you suggest? Rep is subjective by nature, so how do you determine what is "unnecessary"? Not to mention that rep is intended as a fun little aside and not … | |
Re: Change [ICODE]#include "\\bandit.h"[/ICODE] to [ICODE]#include "bandit.h"[/ICODE]. That's more likely to be what your compiler is expecting. You also have a syntax error in the Bandit class' constructor definition. | |
Re: It takes a twisted personality to create multiple accounts so that you can answer your own questions. :icon_rolleyes: | |
Re: Welcome, but we have a specific forum for introductions. If you have a question, go ahead and ask it. | |
Re: >What features would you like to add to /remove from C++? I can't think of anything off the top of my head that I would remove. Redesign perhaps, but not remove. Additions are a problem because the language and libraries are bloated enough as it is. My answer would be … | |
Re: >What does Zw stand for? It's a mystery. The common assumption is that Zw was chosen because it meant absolutely nothing and there was little chance of something popping up that would make it significant. >I'm not able to understand this thing in the italics. Put simply, the Zw* versions … | |
Re: >I don't agree with U. You can disagree all you want, but you're still wrong. >u can search "fflush" in MSDN! MSDN doesn't define the standard library, the C standard does. And the C standard says that calling fflush on an input stream is undefined. If your compiler happens to … | |
Re: >How do you get all the content of that file into your >string without it stopping after the first null.??? It's possible to store multiple strings in one block of memory: [code=c] #include <stdio.h> int main ( void ) { char lines[] = "this\n\0is\n\0a\n\0test\n"; int n = -1; int i; … | |
Re: >I dont understand that behaviour. You're using fgets, yes? Don't forget that fgets also appends '\n' unless the buffer is filled completely. | |
Re: ssharish, could you please go all the way and use complete English words rather than chatty abbreviations? There's no reason to use "u" instead of "you". Those who don't have English as their native language or aren't familiar with chat speak will have an easier time following your posts, and … | |
Re: >Dont define the function within the function. >Its not a good programming practice Yep, it's not a good programming practice because nested functions are illegal in C. I wouldn't call a practice that completely fails to compile anything [I]but[/I] bad. ;) | |
Re: Actually, I was talking about that particular comparison (sub-human to historical mass murderers) rather than how far you can go on Daniweb, but that might spark conversation too. Just don't take it as an invitation to find out how far you can go. ;) | |
Re: >THANKS. For what? We're not going to do your homework for you, so unless you want to receive stony silence or smart-ass remarks, you'd best come up with a precise question (a verbatim copy of your assignment doesn't count) and proof that you've attempted to solve the problem on your … | |
Re: >what's its unit...seconds..milliseconds..microseconds.. >or depends on clock frequency...??? From a standard library perspective, you don't know. Everything after this point assumes non-portable things about your implementation. You can divide the result by CLOCKS_PER_SEC and get the result in seconds, but be sure to cast one of those operands to a … | |
Re: >You were spamming the forum through your signature >and avatar and that violates keep it spam free. Signatures are the correct place for self-promotion or solicitation, provided it's within reason. ithelp's signature is indeed within reason, though that particular discussion may have taken place before jwenting was promoted to moderator. … | |
Re: >I just do not understand what is the advantage of lists over arrays? Insertion and deletion are either equal to or better than arrays in terms of theoretic efficiency. Growing and shrinking a list falls out of the implementation, whereas you'd have to specially design a simulated array to change … | |
Re: "For Dummies" books are dumbed down so much that it's virtually impossible to properly learn a technical subject like programming from them. What's worse is that the authors themselves tend to need further instruction before they're qualified to teach. In other words, "For Dummies" books are written for dummies, by … | |
Re: >has anyone found any significant differences in the VS IDE or >how C++ programs compile, compared to the 2005 version? The IDE is about the same. It's been tightened up in a few places and flows a little better, but all in all it has roughly the same feel as … | |
Re: >any assistance would be great! You neglected to mention what problem you're having. >i'm trying to get my class to point to the array that i have built inside the main function: That's a very bad idea. When classes don't have control over the memory for their members (either directly … | |
Re: >Memory models(header files and so on) Memory models isn't usually a term that applies to headers. "Memory model" typically refers to the rules one has to follow (at an extremely low level) to properly use the memory addressing scheme for the system. >It seems a bit too scattered to me. … | |
Re: >"invalid conversion from 'const double*' to 'double' You mean "invalid conversion from 'const double*' to 'double*''". It's a significant difference, and the error is telling you that you're throwing away the const qualifier without a cast, which is illegal. It's coming from assigning begin (a pointer to const double) to … | |
Re: >I want this to return NULL if the needle string is not found >in the haystack string and otherwise return the pointer to >where the needle is returned. You're in luck, that's precisely how strstr works. >I was hoping someone could help me find a way to implement it as … | |
Re: Daniweb has an IRC channel. You can get to it indirectly through your favorite chat application at irc.daniweb.com, or you can click the "IRC Chat Network" button near the top of the right hand list of navigation links on every page. | |
Re: >I don't know what it wants me to do. >error C2660: 'findLow' : function does not take 0 arguments >error C2660: 'calcAvg' : function does not take 0 arguments Maybe, just maybe, it wants you to pass arguments to findLow and calcAvg? The big problem is that getValues doesn't have … | |
Re: char and byte are basically synonymous: [code=cplusplus] unsigned char array[SIZE]; [/code] |
The End.