6,741 Posted Topics
Re: >i read some articles about a 2-3-4 top-down search tree on the >web, but when i tried to go deep into the problem i realise that >most of the information aren't detailed. Most descriptions of 2-3-4 trees aren't detailed because most of the time it's more practical to simply use … | |
Re: >Both these members have said contradictory things. No, they said the same thing in a different way. back() returns a reference to the value of the last item in the collection. end() returns an iterator to one past the last item in the collection. | |
Re: >borlandc++ 3.11 under windows vista home edition You might as well ask about the coal driven steam engine in your Ferrari while you're at it. | |
Re: That program is actually quite awful. I doubt it would be helpful to anyone interested in learning proper C. On the plus side, the binary search tree code looks decent, though I wouldn't recommend recursive algorithms when they don't buy you anything. | |
Re: >would this be possible using C++ Not standard C++. Do some research on the curses library if you want more control over the console. | |
Re: Keep the list sorted at all times, then the smallest node is always the first. Finding the smallest is a constant operation for obvious reasons, and maintaining it is also a constant operation because insertion of a smaller node is constant as is deletion of the current smallest node. Otherwise … | |
| |
Re: [url]http://msdn2.microsoft.com/en-us/vs2005/aa948853.aspx[/url] | |
Re: [QUOTE]Why does (start+last)/2 work to calculate the midpoint while start+(last-start)/2 does?[/QUOTE] I assume you mean why does (start+last)/2 fail when start+(last-start)/2 succeeds? Most of the time it doesn't. Both calculations have the same result except when the addition of start and last would overflow. The second calculation avoids the overflow … | |
Re: jimm00.kl/jsmith9990/crys0011, don't you think that talking to yourself is silly and answering your own questions is somewhat counter-productive? | |
![]() | Re: >Um i dont know i posted this in the right place You did. >cold u help me out please If by "help" you mean "do it for me", no. If you really do mean "help" as in "I can do most of it, but I have some questions", we can … |
Re: >also give a nice overview of how a member has replied and helped other people. That kind of gives oldtimers the shaft though. For those of us who had thousands of posts long before marking threads as solved was a feature, it would seem like we're less helpful than we … | |
Re: >use something like: fscanf(stdin,"%s", &test); Please don't do that. scanf (or fscanf with stdin) is best avoided for strings unless you know what you're doing. fgets is easier to get right for most people. If you still want to use scanf, at the very least you should provide a maximum … | |
Re: AMD used to be inferior to Intel, but not so anymore. I would say that they're evenly matched these days. Of course, I don't overclock, so I can't help you there. | |
Re: >All I got was, "your code is wrong." That's an exaggeration. You received help for figuring out what's wrong with your code as well as for helping us to help you more. Then you started whining about how we're pricks (probably because we didn't point out every single problem and … | |
Re: If what you posted is what you're actually trying to compile, it's no surprise. No part of that code is valid. ![]() | |
Re: Your code shouldn't even compile. >if(!isdigit(next)) next is a string, but isdigit expects an integer. >double x= atof(next); next is a string, but atof expects a pointer to const char. How about something more like this: [code=cplusplus] #include <iostream> #include <fstream> #include <cstring> #include <string> #include <cctype> #include <sstream> using … | |
Re: Right now your list consists only of nodes. If you want data that applies to the list as a whole, you should create a new structure that contains a list as well as that data: [code=c] struct node { char str[100]; // where the strings will be kept struct node … | |
Re: >cos( n1 ) n1 is an object of NumeroReal, but it doesn't support an implicit conversion to any of the types that cos expects. Perhaps you meant [ICODE]n1.cos()[/ICODE]? That should give you an interesting result too, but it's more likely to take you in the right direction than trying to … | |
Re: It's somewhat difficult to tell you what's wrong with the code when we can't see the code. :icon_rolleyes: | |
Re: >I want to ask if there function in library of c++ to search word in file ?? No. You need to break it down into smaller operations like reading a file and searching a string for a word. Then you can do this: [code=cplusplus] std::ifstream in ( "myfile" ); if … | |
Re: And? What's the problem? Presumably you're traversing both arrays to compare them and stopping when they're obviously different or at the end: [code=c] while ( a != NULL && b != NULL && a->data == b->data ) { a = a->next; b = b->next; } if ( a == NULL … | |
Re: It looks like the location and the robots are disconnected, so the first algorithm that comes to mind is a simple one: [code] for each robot from robots integer r := robot.row() integer c := robot.col() select grid[r][c] from case 'R': grid[r][c] := '2' case '2': grid[r][c] := '3' case … | |
Re: A space character is ' ' and a tab character is '\t'. But you also have a problem with how you're doing the comparison: >if (CR == " " || CR == " ") Because you're using strcpy to fill CR, I can only assume that it's a C-style string. … | |
Re: To delete any node from a single linked list you have the average case and one edge case. The average case is easy: loop through the list until the next node is the node you're trying to delete, and set the current node's link to the link of the node … | |
Re: >to see who's worked the best. That's going to be difficult even if you just stick to profiling. Two of the algorithms sort arrays and two of them sort linked lists, so the innate performance will be different even without the sort. A better test would sort only linked lists … | |
Re: I don't think you have a good design. RetailItem should only specify [b]one[/b] item. To get more than one item, you use an array of RetailItems: [code=cplusplus] #include <iomanip> #include <iostream> #include <ostream> #include <string> class RetailItem { std::string _description; double _price; int _on_hand; public: RetailItem ( std::string description, double … | |
Re: If I understand your problem correctly, you're over complicating things. The map container doesn't allow duplicates, and the subscript operator alone does what you want: [LIST] [*]If the key doesn't exist, create a new pair and return a reference to the value. [*]If they key already exists, return a reference … | |
Re: >You have no business telling me what I am or am not alowed to view. I'm sensing some missing steps in the logic chain. Let me spell it out for you: your school owns the internet connection and thus has every right to tell you exactly what you can and … | |
Re: >what does the "\n" do in oppose to endl; ? endl forces the stream to be flushed, which means that the characters will be written immediately. "\n" doesn't flush the stream, so it's possible that if something happens to interrupt the program between the time you write the characters and … | |
Re: >Can someone please explain to me just exactly this try/catch is doing? It's swallowing errors, basically ignoring them. | |
Re: >Does anyone know of a site that has things like this that I could practice with? Answer questions on this forum. Not only will you get practice solving problems and fixing broken code, you'll also have a bunch of experienced programmers to double check you and teach you tricks. | |
Re: >But why they put a option with struct when they have a class? Why not? How do you know a class was even an option? | |
Re: [code] ShellExecute(0, "open", TEXT("MMPC.html"), 0, 0, SW_SHOWNORMAL) [/code] The TEXT macro either does nothing to the string literal, or prepends L to make it a wide string literal. The errors suggest, that in your setup, a wide string literal is expected. Now, you could just explicitly make the literal wide: … | |
Re: >#include <iostream.h> C++ is defined by the ISO standard, and that standard doesn't specify iostream.h; it's a pre-standard header that most compilers no longer support. If you learn this old version of the language, you'll be virtually useless with modern C++. >#include <conio.h> I'd recommend you forget that this header … | |
![]() | Re: >it doesnt print £ sign Your text editor is using Unicode, but the console is using extended ASCII. Try this instead: [code=cplusplus] cout<<"Salary is \x9C "<< salary_without_overtime <<endl; [/code] ![]() |
Re: >So basically I am asking for code either using tokens or otherwise that could verify user input Hmm, you probably wouldn't like me to recommend Boost::Regex if you're not terribly comfortable with C++. Are you using C-style strings or the C++ string class to hold the input? >I am an … | |
Re: >bool validUserInput (true); This guy should be reset inside the loop. Right now if you fail once, it fails forever. >if ( rate % 2 != 0 ) validUserInput = false ; When rate % 2 is 0, the number is even. This test will set validUserInput to false when … | |
Re: >but why did u make a warning stuff about my language Because that's what our policies dictate (see the emphasized areas for your specific case): [quote] Keep It Clean We strive to be a community geared towards the professional. [B]We strongly encourage all posts to be in full-sentence English. Please … | |
Re: [url=http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_hashtable.aspx]Hash tables[/url] [url=http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx]Hashing algorithms[/url] [url=http://www.eternallyconfuzzled.com/libs/jsw_hlib.zip]Practical implementation[/url] Now quit yer bitchin'. ;) | |
Re: >But how do I go about creating useable names dynamically? Use a map instead of a vector, then you can use a string to index the map instead of an integer, which makes things more meaningful: [code=cplusplus] anims["AnimNormal"]; [/code] | |
Re: >However, am not sure what you mean by n'th last node. Isn't last ... just last? Last is just last, but nth isn't necessarily the last. If you're given n, you delete the node at that position. It's actually painfully easy to do with one traversal if you think about … | |
Re: >so foar I've done this much That's not much considering that the majority of the program's implementation consists of abstract comments. What exactly do you need help with? We're not going to finish this for you, you know. | |
Re: >I'm not sure what you mean by k-way Instead of just taking one stream of data, then dividing and sorting it recursively, a k-way sort divides the initial stream into k smaller streams and sorts each of them individually. By "balanced", it means that the value of k is consistent … | |
Re: I was kind of hoping for more of a psychoanalytic approach. :icon_rolleyes: This thread has promise, but right now promise is all it has. | |
Re: Hi pratiksha. I'm Julienne, and I'm wondering why someone who's working on a doctorate in Computer Science is having trouble selecting a topic. | |
Re: It's not as funny with Daniweb's preview tooltip. | |
Re: >you may not have write access to your command line arguments Both C89 and C99 say otherwise, and they both use exactly the same wording: [quote] The parameters argc and argv and the strings pointed to by the argv array shall be modifiable by the program, and retain their last-stored … |
The End.