3,183 Posted Topics
Re: > cin.sync(); // 'flush' cin stream ... Sadly, [it's not that easy](https://www.daniweb.com/software-development/cpp/threads/90228/flushing-the-input-stream). `istream::sync` is in no way guaranteed to read and discard remaining characters in the stream. The best approach, in my opinion is either 1) don't depend on the stream being 'clean' in the first place or 2) ensure … | |
Re: http://en.wikipedia.org/wiki/Category:Search_algorithms | |
Re: > Please help me with reasons or ideas to support the above statement To qualify Davey's hilarious response, your "question" reeks of homework. As such, we'll require that you put some effort into starting a dialogue by offering the reasons and ideas you already have. Otherwise, we'll be forced to … | |
Re: If there's a write error to the destination stream, you'll get a return value of `EOF`. Typically this means something along the lines of the target device no longer being available or getting corrupted. However, since `puts` writes to `stdout`, this is rather unlikely unless you've redirected `stdout` to a … | |
Re: I'd just escape it: string[] items = str.Split(new char[] { '°', '''}); | |
Re: > can it be omitted in this case? Yes, a `default` case can be omitted if you already cover all of the possible cases, or not executing any of the cases wouldn't be damaging. | |
Re: A blank string is indeed not a valid path. Either you need to account for the possibility of a blank string and act accordingly, or ensure that the blank string doesn't happen. | |
Re: Is this just for practice, or is the disk cleanup utility that comes built into Windows not satisfactory? | |
Re: Databases are pretty fundamental to both parent categories, and while I can guess why Dani put it under web development originally, our current push for tagging rather than categories means that the location becomes less important. Unfortunately, it means that in the interrim there's a bit of confusion. | |
Re: You're thinking about it too hard. Just loop from 1 to 100 and add 10 at every multiple of 10 after updating your sum. for (i = 1; i <= 100; i++) { sum += i; if (i % 10 == 0) { i += 10; } } | |
Re: Here is the fix: for (i = len - 1; i > m; i--, m++) { I'll leave it to you to figure out why that fixes it, but working through the logic with a small line of text on a piece of paper will help greatly. :) | |
Re: > if the str were to be an array of two dimensions, eg. str[][] format how would it look like? In a function declaration, only the first dimension size can be omitted. All subsequent dimensions must have a matching size to the array you pass, so it would be something … | |
Re: > DATA[0] = new int[100]; //this works Yup, as it should. > DATA[1] = new int[100][5]; //but this don't Of course it doesn't, because you're initializing an `int*` with an incompatible type. `int[100][5]` is not compatible with `int*`. You could fake it by saying `DATA[1] = new int[100 * 5]` … | |
Re: It kind of depends on the parts you're finding difficulty with. If you can be more specific, I may be able to offer some advice. Though it's mostly just buckling down and taking more care as you write, which can be beneficial in that it forces you to think more. … | |
Re: What is this and why do you want it decoded? Against my better judgment I'm giving you the benefit of the doubt rather than closing this thread given your posts thus far. | |
Re: > A language expert Mr. ABC objects the designers of C++ on the bases of following two arguments I suspect this 'language expert' doesn't actually write code. Orthogonality is an important concept in language design, yet even more important is sacrificing orthogonality for usability. It doesn't matter how beautiful a … | |
Re: Dave and I go way back, from cprogramming.com circa 2000 to flashdaddy (now entropysink, IIRC), and Daniweb. The banter and sharing of knowledge was top notch every time. :D I think my fondest memories were the many MSN Messenger chats we had about programming and whatever else came to mind. … | |
Re: > Should I be ashamed of myself Certainly not. I spent a number of years on cprogramming.com before moving to Daniweb. The choice was obvious: cprog had a lot of experts at the time and Daniweb did not, I could offer more by switching. Do what's best for you, my … ![]() | |
Re: How about a retroactive featuring of Dave Sinkula, sort of as a memorial to a good friend and a great member? Obviously there can't be an interview, but I think it would be a nice gesture. | |
Re: Typically modern systems will use a cryptographically secure one-way hash to store credentials. Provided the password is strong, coupled with judicious salting, it can be quite difficult to break given only the hash result. Not impossible, mind you, but much more secure than using straight up encryption. | |
Re: The command looks dicey to me. What is 'test'? If it's a variable, the string is constructed incorrectly: "DELETE FROM just WHERE folder = '" & test & "';" If it's a literal value, you need to say as such in the string: "DELETE FROM just WHERE folder = 'test';" … | |
Re: When a picture box is empty, the Image property is null. I'd wager that however you're saving the data doesn't take into account that the image might be a null object. You can either change how you save the data to account for nulls, or ensure that the picture box … | |
Re: It's generally frowned upon since reverse engineering has historically been used for black hat purposes. Further, due to some sticky legal restrictions, I can easily see it being troublesome to have a course focus on it. | |
Re: You need a data structure that can hold anonymous (unnamed) objects of the `struct`. For an unknown number of records, I'd suggest a linked list. Here's something to get you started: #include <stdio.h> #include <stdlib.h> #include <string.h> struct record { char *name; }; struct node { struct record data; struct … | |
Re: The bad news is that if you're not digging it this early, hardcore programming probably isn't for you. Casual programming can remain fun, of course, but any push into serious development or even a career doesn't strike me as promising. The good news is that it can be easy to … | |
Re: But spamming your blog is a good reason, right? ...Right? *sound of crickets* ;p | |
Re: You only update the longest word when it's longer than the current word. If you want the last instance of the longest word when there are multiple instances having the same length, update the longest word when it's equal to or longer: if (strlen(word) >= strlen(max)) { strcpy(max, word); } | |
Re: > because windows operating system get corrupt instantly There seems to be more here than meets the eye. If Windows gets corrupt "instantly", that's suggestive of a deeper problem unrelated to the OS itself. | |
Re: To answer your immediate question, `printf(" %d",ocean[ROWS][COLS]);` should be `printf(" %d",ocean[r][c]);`. The former is flat out wrong in that officially `oceanOne[10][10]` does not exist. In practice it does for your compiler, but only because that's the memory location for `oceanTwo[0][0]`. That's why the first call gives you random numbers while … | |
Re: Hmm, I'm not sure I see the benefit in this case. Though variations on `ForEach` are relatively common. As an example, I have an extension method for `ForEach` over an `IEnumerable<>` and another that reports progress over iteration: /// <summary> /// Performs an action on each item in an enumerable … | |
Re: It's basically telling you `CustomerTBLs` does not exist under the `dbo` schema. My first step would be to carefully check spelling. | |
Re: It pains me to recommend [WiX](http://wixtoolset.org/), given that the learning curve is so high. However, if you want a free option that's not gimped, I think it's the best one. | |
Re: Pretty much all you've got left in the big hitters is Safari. | |
Re: > How much everyone of you has spent on daniweb.com??? I couldn't begin to guess how much time *everyone* collectively has spent. ;D Since 2005 I'd wager my time spent either participating on or developing Daniweb can be measured in man-years. > In your time period what kind of thing … | |
Re: > of course i will read both of papers, and obviuosly i will know the diffrence where it is. That's not enough to write a program. You need to break down things such that a stupid literal child (aka. a computer) could go through the steps and accomplish the goal. … | |
Re: I'm not sure I see the benefit of P2P rather than having a controlling server if you're looking at having secured user access (since you mentioned a password). Sure, you could store an identity account locally and transfer the relevant data to peers on connection acceptance, but that's more of … | |
Re: > Would that not lead to more calls to the db which will affect performance? This question suggests you're either doing more than you've said with the database, or there are a huge number of records. Somehow I don't see an employee table being quite so large that you cannot … | |
Re: InterestRate has a `private` setter, so it's not accessible to callers. AddInterest is a method with no arguments, so the correct call would be: ((DepositAccount)obj[1]).AddInterest(); However, since your interest rate is never modified within the class, you might consider removing the `public` qualifier on the setter. | |
Re: Since you're working with raw keyboard data, there's more work to be done than simply calling `getch` and printing the mask character. You need to recognize a line feed starter as well as any backspacing. Off the top of my head, something like this: #include <iostream> #include <cstddef> #include <conio.h> … | |
![]() | Re: [This](http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx) tutorial may help. |
Re: The big question is whether you can get into the industry with a completely new application. If other companies are so far entrenched that it would be very difficult to compete, reselling is a good approach. However, as a reseller you'd need to bring something special to the table. Usually … | |
Re: > Sadly no one could answer this simple question If you already know the answer such that you know it's simple, why not enlighten us and put the Daniweb geniuses to shame? | |
Re: > I am not able to flush stdin here,is there a way to flush stdin? The only portable way in C (ie. using the stdio library) is to read characters until a newline or end-of-file is found. Of course, this ends up causing a blocking read if the stream is … | |
Re: According to the [documentation](http://msdn.microsoft.com/en-us/library/z50k9bft(v=vs.110).aspx), it's the index in the source array at which copying begins. Presumably the underlying question is *why* is that overload being used when the source index is 0? The reason is that values from the source are being appeneded to the destination rather than copying to … | |
Re: > And also, out of curiousity, are we allowed to put .gifs up as our avatars? Provided the GIF is within our size restrictions, you can upload it fine, but if the original is animated the uploaded avatar will not be animated. The reason for this is we do some … | |
![]() | Re: Structure it however you want. It takes time and experimentation to find a project structure that works for you though. As an example, I tend to use something like this: /codebase /documentation /libraries /media /output /tools |
Re: > Talk to deceptikon. Naruto is soooo last decade. ;) |
The End.