3,183 Posted Topics
Re: Yep, that looks like a bug in the Markdown processing to me. Markdown can be a little tricky when it comes to lists and code blocks. In this case, you can double tab the code to nest it underneath the third list item and the block is formatted correctly, or … | |
Re: We're clearly the devil's spawn, being all objective and fair. ;) I'd wager this complaint has something to do with not being able to differentiate between enforcing the rules as a moderator and participating in discussions as a member. | |
Re: I'm unable to reproduce that output with the posted code. | |
Re: > Quicksort is implemented in C with the qsort() function. The interesting thing is the C standard doesn't in any way require that `qsort` be implemented as quicksort, nor does it impose any performance requirements in the same way that C++'s `sort` function does. The C++ standard retains this lack … | |
![]() | Re: > For me theres really only one language that can truely be classed as an omnipotent language for all types of program. Machine code. Its slow to learn but once you have a good set of documented building blocks the rest is easy to adapt to fit whatever use you … |
Re: > `void print_all(int [][][],int,int,int);` All but the first dimension requires a size. > `print_all(arr[][2][3],degree,row,col);` No indexing is required here, just use `arr` as the argument. | |
Re: > char names[100]; - its just a character array which can hold 99 characters and the last one will be '/0' Yup. > char \*names[100]; - All the 100 array elements are character pointers and are pointing to the starting element of 100 names somewhere in the memory location. Close. … | |
![]() | Re: > Just got a jab in my gum to numb it, and the dentist yanked it out. I had to go down and have all four cut out since they were all impacted. Recovery wasn't that bad though. I've had worse surgeries. |
Re: > Not all compilers are so compliant... That sounds reasonable on the surface, but has an undertone of irrationality if you think about it. Where do you draw the line for features that are hard requirements in a conforming compiler? If the bar is as low as this, it can … | |
Re: First and foremost, the `argv` array always ends with a null pointer, so there's a possibility that either `argv[1]` won't exist, or it's `NULL`. You really need to check `argc` and act accordingly: if (argc > 1) { // argv[0] and argv[1] are safe to reference } Second, `malloc(strlen(argv[1]))` has … | |
Re: > Is this issued happening because I have "fileName" still open as "objReader"? Yes. > If this is the case, is there a way to close it while still in my loop? Well, you could dispose of the reader and break out of the loop, but that's very ugly and … | |
Re: > And i don´t know why the program returns can't open file. `fopen` sets `errno` on failure, which you can query to find out why. The easiest way here would be to interpret the error code using `strerror`: if(!(fd = fopen(buf, "r"))) { printf("can't open file `%s`: %s\n", buf, strerror(errno)); … | |
Re: > word= (char *)malloc(sizeof(char)*100); `word` is a completely separate and independent entity from `words[i]`. Essentially what you're doing here is creating a new pointer, allocating memory to it, then throwing it away (along with losing your only reference to the allocated memory). > words[i] = (char *)malloc(sizeof(char)* 100); Here you're … | |
Re: Why are you confused? What have you done? What have you considered? What are you having problems with? Did you try anything before running for help? Simply posting your homework problem with no other substance is not only frowned upon here, it's actually against Daniweb rules. | |
Re: > If that helps. Not really. What *would* help is paring down your code to the absolute minimum without eliminating the error and posting it here so we can see what's going down. Typically that error occurs when you have a syntax error somewhere above the line that's reporting it. | |
Re: > Why is this so? `rand` is always seeded with 1 by default, so unless you change the seed with `srand`, the sequence will be consistent. | |
Re: A loop is simple enough, but you can LINQize it fairly easily: var everyNth = src.Where((x, i) => i % n == 0); That gives you the elements, and copying them to another array is trivial. | |
Re: > So yes, you can determine what the original source code looks like if there is no obfuscation/cryption. For .NET to a certain extent. It won't match the original source since higher level constructs are represented internally with lower level constructs, but you can get close enough to have a … | |
Re: > Ok lets make this more hypothetical, if you completely redesigned a computer and re-wrote the entire operating system could you have a computer that doesn't need ram. From my understanding ram is the middle man, you transfer data from your hard drive to your ram and then to your … | |
Re: Nice. You might also consider including `goto`-based equivalents for each loop to really nail down the underlying logic. | |
Re: > `total += float read_input( a,b , c ,d,e );` The syntax is wrong for this line. First, the `float` keyword is unnecessary (perhaps you meant it to be a cast?). Second, `read_input` does not accept any parameters, so the arguments are also not needed. Try this instead: total += … | |
Re: > then the type of the expression is The longest, floatiest type. | |
Re: > So are you one of the 11 million and will you still be on July 15th? In my experience working with a number of companies as customers, Server 2003 has almost entirely been replaced with Server 2008 R2. I can only think of two customers that still have an … | |
Re: As a senior systems engineer for a tier-one world-wide engineering company, you must be familiar with the mutually exclusive goals of getting things perfect and meeting deadlines. There was *immense* pressure to get this system rolling before a hard and somewhat unreasonable deadline, and we'll be working equally hard to … ![]() | |
Re: > In this case the first is more readable and easier to code right? If all you need is read-only context, sure. Two cases where it's not easier is when you want to index of the enumerated item and when you want to replace the enumerated item. A `foreach` loop … | |
Re: At the very bottom of every page are lists of links, which include the article workshop that's filtered based on your user permissions. | |
Re: > when one left side and one right side child complete then system credit 700 to parent id I don't understand your question. Do you mean when a node has two children, 700 is added to a value in the node? | |
Re: > Linked lists are elegant, but inefficient to keep sorted. Not if you use a hybrid tree/list, hash/list or a skiplist. :D But those implementations aren't as blindingly simple as a regular linked list, so you don't see them often. Data structures are an exercise in trade-offs. You can have … | |
Re: You can't (easily) delete the file while it's locked for reading, so I'd alter the logic so that you break out of the reading loop, destroy the reader object, *then* delete the file safely. | |
Re: You won't find it here, Daniweb is not a homework service. We'll be happy to help you with specific problems in *your* code, but we won't do your work for you. | |
Re: > PLEASE HELP AS SOON AS POSSIBLE. Please read our [rules](https://www.daniweb.com/community/rules) as soon as possible. Thanks. | |
Re: You have an array of pointers to random memory, not an array of pointers to infinite memory usable by your program. This code practically begs for segmentation faults due to trashing memory. You need to either specify a size for your strings: char bookName[N][50] = {0}; for (size_t i = … | |
Howdy all. I've recently been considering doing an online meeting or webcast on certain subjects for which I have a lot of experience or knowledge. The idea being that something too long or complex for a Daniweb article can be more easily shown by sharing my desktop and talking about … | |
Re: There's no requirement that a DataGridView be initialized in the form Load event. Obviously you need to do it *somewhere*, but where kind of depends on the design of your application. Ideally it would happen in one of two places: 1. Immediately before the user needs to see that information … | |
Re: > thanks guys u lost the chalnge Believe it or not, we can tell the difference between a legitimate challenge, and a lazy student trying to trick others into doing their homework. Your 'challenge' is clearly the latter. > c u in a next question I hope not, we already … | |
Re: `gotoxy` let's you move unconditionally, but with standard output you need to print whitespace: #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { int n = 15; cout << setfill('*') << setw(n + 1) << "\n"; for (int i = 0; i < n - 2; i++) … | |
Re: I'm a little biased as this kind of thing is something I use liberally to avoid duplication, but it's also a good practice in general. One thing to note though is performance. Refactoring into methods and lambdas does tend to introduce overhead, and you should take that into consideration for … | |
Re: > Actually this should probably be moved to snippets Done. :) | |
![]() | |
Re: > insead of talking, Dani should sit and rewrite it That's not how professional software development works. First the requested feature is discussed for viability: * Is this feature necessary? * Is there an acceptable workaround? * Does the feature fit within the intended design? If it's determined that the … ![]() | |
Re: Laziness is certainly an issue, and sadly there's nothing we can really do about it without instating draconian policies. Another common reason for vague or poorly worded questions is non-native English speakers having trouble formulating their thoughts. The former is obvious, and with a little practice the latter is as … | |
Re: Your pointer is null. Any attempt to dereference it invokes undefined behavior. The second snippet running okay is merely bad luck because it suggests that the code isn't glaringly broken. | |
Re: > he told me that most of the good programs does not use goto statement That's not necessarily true. There's a lot of (well deserved) hate for `goto`, but it's not inherently broken or bad. The problem is that a *lot* of poorly written code has abused it in the … | |
Re: > Congratulations! You're no longer a DaniWeb newbie.<br /> <br /> Why do people feel the need to post the contents of this notification? I'm genuinely curious. | |
Re: I see two problems immediately: char* names; This represents an uninitialized pointer, not a pointer to infinite available character slots as you're using it. I'd strongly recommend using the `std::string` class instead. Otherwise you'll need to dynamically allocate memory to that pointer manually for each instance of the structure. for(int … | |
Re: > the console I/O library is not a standard part of C, and is associated with older (that is, pre-C99) Borland compilers. Some common modern compilers support it. I don't see any clear indication that this is a pre-C99 compiler, though use of `fflush(stdin)` narrows things down a bit as … | |
Re: > My main focus of this question is the use of objects within Interfaces, is this common practice, or even acceptable? Your interfaces contain properties rather than objects, which is just fine and quite common. My issue with the code is twofold: 1. It's overly complicated for what seems to … | |
Re: Yes, of course. But for homework questions we require some substantial proof of effort on your part. | |
Re: > Tried different things myself, but as I'm a still a learner and could find nothing useful on the web, I'm a bit stuck. It may help your search to know that what you're looking for is called return type covariance. To simplify your search drastically, C# doesn't support it … | |
Re: There's insufficient information. Please post the relevant code, the relevant part of the file if you're using one, and the exact error as Visual Studio reports it. |
The End.