3,183 Posted Topics
Re: You need to include a header with the declaration of XMLElement (not to mention <string> for the std::string class). Just because the library is linked doesn't mean the compiler won't complain about unrecognized types. | |
Re: You have to be *really* careful when treating strings as raw memory and vice versa because raw memory can have legit embedded null characters. The problem you're having is basically you stop processing on a null when you should keep going. I made a few changes that fix your problem. … | |
Re: Are precompiled headers enabled for the project? That's what stdafx.h is, all of the standard headers precompiled into one so that you don't have to include them as needed. The down side is that your code is closely tied to the compiler. Ideally you'd disable that feature and include <iostream>. | |
Re: Do you know how to write an `if` statement? There are three cases: if (number == 0) printf("0"); else if (number < 0) printf("-1"); else /* number > 0 */ printf("1"); Easy peasy. | |
Re: > Sorry for providing a bad practice. Apologies in advance, but that's not the worst practice in your example. My vote would go to this gem: for(loop = 0; loop < strlen(string); loop = loop + 1 ) The inner loop exhibits the same problem, which is calling strlen() in … | |
![]() | Re: Love it! Such a simple thing, but seeing who solved it and when is handy info. |
Re: This is easy to find information. Where did you search before posting here? | |
Re: Does the constant *have* to be private? It seems silly to require it to be private and also require it to be accessed directly from outside of the class. | |
Re: > Does the following code make p as a null pointer Yes. Static variables are zero initialized, which for pointers means the equivalent of NULL. You can verify that this is the case (other than reading the standard documentation) with a simple test: #include <stdio.h> static int *p; int main(void) … | |
Re: By dropping down a level, you need to handle lower level concerns like string termination: ob.read(word, sizeof word - 1); word[ob.gcount()] = '\0'; | |
Re: > So what do you do to pass the time at work when it becomes a bit quieter and you have nothing else to do? Posting on Daniweb, working on Daniweb's code, surfing the web, personal projects, etc... | |
Re: The winner for me is Everquest 2. I started playing at launch (2004) and never stopped. Amazingly enough, the game is still interesting and I put a lot of time into it. > I actually preferred Oblivion to Skyrim Me too. Maybe it's because I burned myself out on Oblivion … | |
Re: Please read our rules concerning homework. Simply posting your homework question is a good way to have the thread deleted. | |
Re: It looks straightforward. Are all records separated by multiple blank lines? Really all you'd be doing is writing an algorithm to read a record and write some of the data onto a single line of output. My very first programming job was writing report filters almost exactly like that in … | |
Re: At least you waited a whole 11 hours before complaining about not getting help. Keep in mind that the forum is a volunteer effort. If you want to guarantee immediate help, you'll need to find a paid support service. I also notice that two of your articles are not trivial … | |
Re: > Anyone willing to assist? Willing yes, but not capable with such a vague description of what you want to do and the problems you're having. | |
Re: Anytime you get a large negative number, there are two things to check straight away: 1. Any uninitialized variables in your math. 2. Any out of bounds indexing or invalid pointers (they can corrupt other variables). Either way the problem isn't in rand(), it's your code doing something funky. | |
Re: Network places isn't a directory, it's more of an ad hoc listing of visible network devices. You can get a similar listing with the `net` command: `C:\>net view`. Or use the `/?` argument to get a summary of arguments for `net`. | |
Re: Seems okay on my end. What browser and OS? Did you try clearing your cache and doing a hard refresh of the page? | |
Re: > Do you guys have any advice for me? Probably nothing you haven't already heard. > If you could do it over again what would you have done differently? Most certainly, I would have. If I knew what I know now, I'd probably not have gone the IT/developer route and … | |
Re: 2D arrays aren't a single entity like in some languages, they're arrays of arrays. What you're actually trying to allocate here is a pointer to `size` arrays of `size` int, and the destination type needs to reflect that: int (*b)[size] = new int[size][size]; This is assuming `size` is a const … | |
Re: It's a program with a menu of user options in the interface that guides what the program does. There's no magic or complex logic here, it's just a simple menu. | |
Re: The loops are a red flag for me because they count from 1 to `n` instead of from 0 to `n-1`. C# arrays are zero based, so even if `n` represents a safe limit for the array, you're still looking at an off by one error. | |
Re: Automagic synthesis of a default constructor is disabled when you provide any explicit constructor. If that explicit constructor has arguments and not all of them are defaulted, then your class will not support a default constructor unless you explicitly define one. Your class has a seven argument constructor, so the … | |
Re: [This article](http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048384015&id=1043284392) may help you with using the directional keys. Turbo C supports the getch() based solution. Note that it *only* describes how to capture and respond to those keys. What you do in the response is where most of the real work lies. ;) | |
Re: How are you calling the C++ program? Is it C++/CLI and a .NET assembly or are you using COM? Or are you just calling a program that happens to be written in C++? | |
Re: No. Daniweb is not your personal homework service. We require that you make an honest attempt to solve the problem. Please read our rules. | |
Re: One possible effect of undefined behavior is producing the expected result. That's why it's so difficult to explain to someone whose program is working that it's broken and wrong. | |
Re: The easy solution is to not use gotoxy(). It's a Borland holdover from the days of yore where 640K wasn't a laughably small amount of memory. Get with the times and write a *real* GUI if you need more control than the command prompt provides. Alternatively, you can [search google](http://lmgtfy.com/?q=code%3A%3Ablocks+gotoxy). … | |
Re: Why did you create a second thread for the same question? | |
Re: Please post a small program that exhibits the problem and a sample of your CSV file. scanf() format strings can be tricky, and scanf() is usually unsuitable for true CSV, but if it's just a naive comma separated format without embedded commas, you can get away with using scanf(). | |
Re: > No one said you have to use intellisense. I don't use it, or very seldom use it. I don't use it for C or C++, but for C# and VB.NET it's mighty handy (and actually works). > As for the debugger, I use it often. The debugger is the … | |
Re: > From what I understand is Java is mostly understanding, implementing, and manipulating algorithms. That's universal, it's not unique to Java. > To me this seems like I just used a simple algorithm to obtain the desired result. In my opinion, a good professional would start with the simplest algorithm … | |
Re: Neither of those are an equivalent to PHP's explode(). To do it thoroughly you'd need to include all of the logic for the limit and any edge cases that affect the result. I hacked this up pretty quickly from the PHP manual's definition, but it should be close: #include <cstdlib> … | |
Re: You need to validate the password completely, *then* display the output: #include <stdio.h> int main(void) { const char *pass = "letmein"; int ch; // int, not char! while ((ch = getchar()) != '\n') { if (ch != *pass++) break; } if (*pass) puts("Invalid password"); else puts("Welcome!"); } Note that your … | |
Re: Delete line 6, you're hiding the global variable with a local variable. Any changes to the local variable are lost on each iteration of the loop. | |
Re: Figure out what the package is intended to do and name it appropriately. | |
Re: What compiler (or I suspect IDE) are you using? | |
Re: When creating a new article you can select both the type and the forum. So if you're posting from the C++ forum, the selected forum for the new article will be C++, but you can change it using the selection list before posting. I imagine that as a more general … | |
Re: What do you mean by "does not work"? If you mean that it doesn't sort the array properly, then your radix sort is broken and you need to check the algorithm. Perhaps compare what you're doing logically with a [working radix sort](http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx#radix). | |
Re: > I used eof() and good() function but there is no change in the output. They're both wrong, so I'm not surprised. The problem is that both eof() and good() will only switch state *after* you've tried to read from the file and that attempt fails. So you need some … | |
Re: What is "FYP"? Anyway, if you're looking for a fuzzy string comparison then a good start would be with [Levenshtein distances](http://en.wikipedia.org/wiki/Levenshtein_distance) or [Soundex](http://en.wikipedia.org/wiki/Soundex). | |
Re: I don't want to tell you to give up, but judging from your question I'd say the likelihood of failure in this project is near 100%. Have you done *any* research before running for help? | |
Re: The error suggests that mysql_query() returned FALSE as mentioned is one possible return value [here](http://php.net/manual/en/function.mysql-query.php). You need to extract more information to properly diagnose the failure: $query = ''SELECT * FROM internet_shop'; $result = mysql_query($query); if (!$result) { die("'$query' failed with error: " . mysql_error()); } | |
Re: Your base class is undefined. Check your spelling, then check to make sure that you're including the appropriate files and have appropriate declarations in place. Your question lacks necessary information to help any further. | |
Re: That's actually a good question because you've stumbled on a subtle behavior of keybd_event(). What it does is queue up key presses to the program with focus. In this case that program is itself (confused yet?). The problem is that this program isn't listening for input, and doesn't ever listen … | |
Re: > how to install window I can't imagine how anyone would think that's a coherent question. Try again. | |
Re: Is it *any* ad or only certain ads that cause the problem? | |
Re: > may be i can download unix, linux on CD or some program that let me do this. There are distros of Linux (such as Knoppix) that can be run from a live CD. Do a google search for "Linux live CD" and you'll get plenty of hits. | |
Re: Everything you get from the keyboard is a character. To extract an integer you need to read multiple characters and append them to an integer value, or store them as a string and then subsequently convert that string to an integer value. Either way you're doing a string to integer … |
The End.