6,741 Posted Topics
Re: My interpretation is that the array is empty when [iCODE]size <= 0[/iCODE]. | |
Re: [QUOTE]How can I get a new line in messagebox?[/QUOTE] Try using "\r\n" instead of just "\n". | |
Re: There's nothing you can do in this situation. The file needs some kind of formatting to differentiate between codes, such as a separator or a guaranteed field width. If you can have codes of varying length all mushed up next to each other and no way to determine where the … | |
Re: >I'm new to C++ and any help would be appreciated. At least start trying to solve your problem before asking for help. It makes us like you more and ignore you less. | |
Re: [URL="http://4.bp.blogspot.com/_LZ92yTgKeAQ/SxcF-XUNEII/AAAAAAAAJcY/nutFWYJ6_2Y/s400/thumbsUp.jpg"]*thumbs up*[/URL] | |
Re: Just because you can cast an object to a pointer to char doesn't mean it's safe. Unless your class is [URL="http://en.wikipedia.org/wiki/Plain_old_data_structure"]POD[/URL], punning to a byte stream is begging for data corruption. | |
Re: [QUOTE]When char can take integer values from -128 to 127 and both 290 and 20000 are welll out of this range[/QUOTE] First, there's no requirement for char to have that particular range. Second, when char is signed, overflow results in undefined behavior. Your code is very dangerous. In your case, … | |
Re: The underlying problem is failure to include <stdlib.h> and using the abort function without a visible prototype. | |
Re: The best cast for quicksort is an already sorted array when the implementation checks for an already sorted subset. In such a case, no partitioning takes place and no recursive calls are made, which results in linear complexity: [code] function quicksort(a, first, last) if is_sorted(a, first, last) then return end … | |
![]() | Re: [code] #include <vector> std::vector<std::vector<T> > mat; [/code] |
Re: >void main() *smack* Main returns int. >atm it crashes when i type in JACK ROBINSON or any incorrect data... I can answer your question with another question: Where do your pointers point? If you said "I don't know", you're right, and that's why your program crashes. | |
Re: [QUOTE]I cannot see why this should give an error, the base class pointer reference is declared as referring to constant pointer memory.[/QUOTE] The problem isn't about const, it's about an added level of indirection. a_t** and b_t** are incompatible types; you were expecting polymorphism to be recursive through all levels … | |
Re: Is the particlesToRender array (assuming it's an array) being used polymorphically? | |
![]() | Re: [QUOTE]I don't see whats wrong with good ol' C++.[/QUOTE] One example, two words: string processing. |
Re: Some more code would be helpful, like the relevant part of your main(). The only errors I see as far as class setup goes are that your constructor and destructor have return types, which isn't allowed. | |
Re: [QUOTE]This is an example in my book but I don't understand where you get the value for "A", "C" or "rad" when it's not given a value anywhere in the code. I feel really stupid, that I don't get it.[/QUOTE] Let's use a simpler example and focus on how functions, … | |
Re: [QUOTE]Abstraction means Giving only essential things and hiding unnecessary details.[/QUOTE] Implementation details are often hidden away behind a more intuitive interface in abstraction, but that's not required. Abstraction is the process of matching the representation of data or algorithms to their meaning within a program. It's a method of implementing … | |
Re: [QUOTE]I'm such a bad person .. :-<[/QUOTE] Votes are a pretty subjective thing. You're more likely to get frivolous votes because they're anonymous (haters like this) and don't apply toward reputation (people with strong negative power tend to like this). I doubt anyone thinks you're a bad person because you … | |
Re: [QUOTE]The thing is i don't want to scan the entered data to a temporary variable and then put it into the file[/QUOTE] Why not? [QUOTE]Is there any way to do so?[/QUOTE] Nope. At some point during the process you'll be using memory. [QUOTE]If not, what is the most efficient (memory-wise) … | |
Re: [QUOTE]still I did not figure out how to get rid of the array limit MAXDATA of number of records.[/QUOTE] Maybe that's a hint that you shouldn't be using an array to store records. ;) For an address book, searching is the primary task, so a data structure that supports dynamic … | |
Re: New posts have been split into a new thread. usedtoworkhere, please don't resurrect an existing thread unless you have relevant information which adds to the discussion. "Me too" posts are better served with a new thread to avoid confusion in the case of similar but unrelated issues. I'll also ask … | |
Re: [QUOTE=iamthwee;1567326]Nice work. But generally people want to KEEP single spaces and remove more than double spaces. [url]http://www.daniweb.com/software-development/cpp/threads/106452/518972#post518972[/url] Also look into writing a trim function. [url]http://www.daniweb.com/software-development/cpp/threads/155472/729101#post729101[/url][/QUOTE] Maybe we can steal Apple's catch phrase and modify it for C++: "There's an algorithm for that". [code] #include <algorithm> #include <cctype> #include <iostream> #include … | |
Re: [QUOTE]I'm back...[/QUOTE] Woot! :) | |
Re: gets() is broken by design and you should use fgets() instead, but unless "program not run" means you're scared of a compiler warning to that effect, fgets() will likely suffer the same issue because the problem is in [B]your[/B] code or [B]your[/B] assumptions about the environment. You should learn to … | |
Re: [QUOTE]whether or not you use command-line arguments for this program, you should get in the habit of defining your main() as:[/QUOTE] Why define parameters that aren't used? You're lying to readers of your code by saying that you'll use command line arguments and then not using them. Not only does … | |
Re: The [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Member Rules[/URL] link is at the top right of every page just above the search box, along with the link to your control panel. | |
Re: Are you asking a question, or just showing off your substandard programming abilities? | |
Re: I'm not sure you're using "order" the way it's usually used. The order of a B+ Tree refers to the maximum number of children an internal node could have. Can you be more specific as to what you're asking? | |
Re: It works the same way with vectors. But since vectors grow dynamically, be extra careful that the index isn't out of bounds. | |
Re: Take the <T> part out of your forward declarations. You're just declaring a templated name, not instantiating it. Technically, you could do this since the template parameter name isn't used: [code] // Forward declare Foo<> template <typename> class Foo; [/code] | |
Re: I'm sorry, you have the wrong forum. I believe you were looking for the [I]psychic friends forum[/I]. | |
Re: Try putting another loop inside of your present loop where the outer loop handles rows and the inner loop handles columns. | |
Re: Shall we start with the fact that the standard string class is in the std namespace? You're treating it as if it's in the global namespace. | |
Re: Sorting a binary search tree means rebuilding it completely, because the structure depends on a relational comparison of the key. If your address book isn't large, you'd probably be better off simply using an array and sorting it as necessary, with a binary search (bsearch) to keep lookups snappy. If … | |
Re: [QUOTE]You can not increase the memory of a system using a file.[/QUOTE] It's called virtual memory. By paging blocks in and out of files, you can expand the perceived limitation of RAM at the cost of performance. Modern operating systems will typically do this already, but if you're on something … | |
Re: [QUOTE]Is there an IT meetup also but online, so other posters around the world can participate.[/QUOTE] Have you tried our IRC chat room? | |
Re: [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]Clicky[/URL]. | |
Re: I can't believe nobody mentioned that you need to include string.h. :icon_rolleyes: :D | |
Re: The usual solution is: [code] cin.ignore(N, '\n'); cin.get(); [/code] Where N is a suitably large number for clearing extraneous characters from the stream. | |
Re: Your personal feelings on the matter match our policies. Homework questions are fine, provided the student puts forth some effort and doesn't expect helpers to do the work. On the other side of the coin, helpers should refrain from giving away homework answers which tempts students to cheat and is … | |
Re: Objective-C is different enough from C that posting questions in the C forum probably wouldn't buy you much. For languages without a dedicated forum, the Legacy and Other Languages forum is there as a catch-all. Or if you can find enough people interested in an Objective-C forum, Dani may be … | |
Re: [QUOTE]the following code that I have written only takes me about half way there[/QUOTE] Excellent. Now do the same thing again, but this time reverse your starting and ending points, and count down instead of up. | |
Re: [QUOTE]yeah close it....[/QUOTE] I think I'll go ahead and do that. This thread isn't likely to go anywhere except a downward spiral. [QUOTE]tell how to delete you a/c[/QUOTE] Accounts aren't deleted so that Daniweb can conform to anti-spam laws. You can simulate the effect by removing all personal information and … | |
Re: Formatted input (with the >> operator) and unformatted input (getline is an example) don't play well together. It's a subtle combination of features that work together to give you this bug: [list] [*]Requests only block (wait for you to type) if the stream is empty [*]Operator >> first discards leading … | |
Re: Can you be more specific about when you want an blank line? Because as I see it, doing it at the same place as the [ICODE]stardId[i]==bestId[j][/ICODE] comparison will most certainly result in a lot of blank lines unless the two files correspond in the ID field. |
The End.