3,183 Posted Topics

Member Avatar for preety girl

> HI everyone ,In this semester i have a course on data structure , My teacher is going to recomend us C# or C++ for implementing structures . i have good skills on c language and java but dont know C# and i hate c++(however i have learnt some bit …

Member Avatar for deceptikon
0
137
Member Avatar for daino

> If I write a C++ program and compile it into an executable file AND, don't have to install the program, will I have trouble running that C++ written program on other platforms? Yes, you probably will. The executable itself is specific to the operating system and chipset where you …

Member Avatar for deceptikon
0
345
Member Avatar for adishardis

$table1 = "<div id=\"container\"><table id=\"table-3\" cellspacing=\"0\"><thead><tr><th>Totalt</th><th>" . $Totalt . "</th><th>Benchmark</th><th>Differans</th></tr></thead><tbody>";

Member Avatar for blocblue
0
124
Member Avatar for decade88

When you open a stream and then read to the end, it doesn't magically reset to the beginning at the programmer's convenience. In fact, it stays right where you last stopped reading. You need to clear the error state (because it will be marked as end-of-file) and reset the get …

Member Avatar for deceptikon
0
143
Member Avatar for robertstan79

How are you storing the graph? That kind of matters in the implementation. ;) Another critical factor would be whether there's a cycle in the graph or not. It's simpler if you don't have to consider revisiting a node. In fact, if there are no cycles then you can probably …

Member Avatar for deceptikon
0
106
Member Avatar for Sendy Hipo

> size_t //Eerm, what is size_t? It's a typedef for an undisclosed unsigned integer type (usually int or long). It's defined in <cstddef> along with a number of other C-inherited headers, and the intended usage is as the result type of the `sizeof` operator. Since `sizeof` is often used to …

Member Avatar for Sendy Hipo
0
961
Member Avatar for gem.gonzales.9

If by "help" you mean "do it for me" then no. If you want actual assistance rather than a hand out, then please ask a specific question.

Member Avatar for WaltP
0
160
Member Avatar for Lord_Migit

You can't use the == operator to compare arrays. Well, you *can*, but it almost certainly doesn't do what you expect or want. Ideally you'd use a std::string object instead of an array of char for strings, because then the == operator is overloaded and does what you want. Otherwise, …

Member Avatar for Lord_Migit
0
196
Member Avatar for rajshrimohanks

> I came across this program in the C++ section. How to do something similar in C? While that program is indeed written in C++, the conversion to C is trivial as the overall structure doesn't depend on anything specific to C++. The library being used is Windows' Win32 API. …

Member Avatar for rajshrimohanks
0
2K
Member Avatar for fatimah batool

Is it airline reservation homework time of year already? Oh, how the year flew by. :D

Member Avatar for Schol-R-LEA
1
200
Member Avatar for sebass123

> It compiles and runs up until the first function is called then crashes I'm surprised it compiles. What compiler are you using? Anyway, there are a number of problems with your code such that it would be faster to give you a good example instead of enumerate the existing …

Member Avatar for Perry31
0
124
Member Avatar for napninjanx

Good hackers know how to program their own exploits and tools. Bad hackers, also known as script kiddies, mindlessly use exploits and tools written by good hackers. This is all using the negative connotation of "hacker", by the way.

Member Avatar for firdousahmad
0
227
Member Avatar for mike_2000_17

Dani and I have been discussing it furiously for the last couple of days. Hopefully we'll have an idea of what's causing it soon.

Member Avatar for Dani
1
563
Member Avatar for alvarogomezuria

> Is it clear now? Very clear, but C++ isn't suited to this kind of dynamic programming. A better solution would be to return a reference to the object rather than the name of a variable (which is lost during compilation).

Member Avatar for alvarogomezuria
0
204
Member Avatar for alpaba

Your best bet to simply ask questions, and everyone who answers can be your mentor for that thread.

Member Avatar for deceptikon
0
32
Member Avatar for diafol

We could probably do it dynamically with a profile setting, but I think Dani is very much against plain text in the editor given that its highlighting capabilities are one of the primary reasons we chose it. Is there anything broken with the highlighting such that you want to turn …

Member Avatar for diafol
0
167
Member Avatar for anuran
Member Avatar for rubberman
0
502
Member Avatar for aasi007onfire

> AFAICT, we've unfortunately lost the ability to close threads... As a moderator you can close the thread by editing it and checking the "This Article is Closed" check box.

Member Avatar for deceptikon
0
277
Member Avatar for shibu2all

When testing sort routines visually I'll usually use a before and after printout: void quick_sort (int *a, int n) { if (n < 2) return; int p = a[n / 2]; int *l = a; int *r = a + n - 1; while (l <= r) { while (*l …

Member Avatar for sethlahaul
0
188
Member Avatar for sparsh610

> but what if question arise to reverse the link list without using pointers? Is it still a singly linked list? Are you allowed to create another variable or data structure to hold the reversed data? Is this a hypothetical question? ;)

Member Avatar for sethlahaul
0
172
Member Avatar for lastbencher

I wouldn't include print statements in these functions, as that limits flexibility. Rather, they should return some sort of error status (NULL is a common option). > Is it necessary to free the memory of the node that is deleted? Yes.

Member Avatar for sethlahaul
0
215
Member Avatar for kris222

> Why do you think there are soo many programming languages? Off the top of my head: * Because one size doesn't fit all, and different languages suit different purposes. * Because computer science continues to evolve, and yesterday's language may not be suitable for today's needs. * Because programming …

Member Avatar for iamthwee
0
127
Member Avatar for Nirvin M

> Why does the following snippet produces different result than expected? Undefined behavior was invoked. Your expectations are invalid. http://en.wikipedia.org/wiki/Undefined_behavior http://c-faq.com/expr/evalorder1.html http://c-faq.com/expr/ieqiplusplus.html

Member Avatar for TrustyTony
0
184
Member Avatar for lulug76

> Searched all over the internet but all the programs provided are not working!! You could try to understand the algorithm and write your own, or strive to make the programs you found work...but that might be too much to expect from today's programming students who seem to want everything …

Member Avatar for deceptikon
0
194
Member Avatar for monmondiesel

You have no choice but to allocate new memory and copy the data pointed to by the pointers. The most robust way to do this would be to write a copy constructor for each of the structures that needs to handle a deep copy. And of course, when you write …

Member Avatar for deceptikon
0
4K
Member Avatar for learner_new

Input using the >> operator is delimited by whitespace, so by default you'll only read the next "word" in the stream. If you want a full line, use getline().

Member Avatar for learner_new
0
235
Member Avatar for triumphost

> So why does this happen? If you try to call an explicit constructor with an implicit expression then obviously it's going to fail. That's what `explicit` means.

Member Avatar for deceptikon
0
3K
Member Avatar for TheWolverine

> Initially, this was a quick and dirty way to do this, and worked well, but it's turning out to be quite unwieldy now with all the if-statements. I'm sure there must be more intelligent ways of doing this. It's funny that right as I hit the "huge list of …

Member Avatar for TheWolverine
0
241
Member Avatar for Ancient Dragon

Those names are stored as strings within the thread table for maximum efficiency. Updating them when making a name change would be unreasonably expensive (since we'd have to go through *every* thread from the beginning of time), and storing a link to the actual user to get the name would …

Member Avatar for TrustyTony
0
208
Member Avatar for salah_saleh

First step: check to see if malloc() failed before dereferencing ptrCand: Cand* ptrCand = (Cand*)malloc(sizeof(Cand)*rows*cols); if (!ptrCand) { cout << "malloc() failed!" << endl; } else { ptrCand[16*1024+16].status = 0.5; /* exception happens here*/ }

Member Avatar for salah_saleh
0
3K
Member Avatar for MasterHacker110
Member Avatar for triumphost

> Why should I override my constructors or add a move/copy to this class as the compiler suggests? As the compiler suggests? I assume you're getting a warning to that effect, what does it say?

Member Avatar for mike_2000_17
0
4K
Member Avatar for lxXTaCoXxl

> x += buffer.str; // Problem str() is a member function: `x += buffer.str();` > double y = atof(x.c_str) * Multiplier; // Problem c_str() is also a member function: 'double y = atof(x.c_str()) * Multiplier;' Repeat that fix for every usage.

Member Avatar for NathanOliver
0
238
Member Avatar for Perry31
Member Avatar for Perry31
0
687
Member Avatar for ethio

A heap is *like* a binary search tree, but it isn't one. The heap property is less strict in that you can't tell from the current node whether to search the left or right subtree. All you know is that the item in the current node is a match, couldn't …

Member Avatar for deceptikon
0
244
Member Avatar for Netcode

> What is this new system we're talking about? It's uniquely Daniweb's. Dani and I wrote it from scratch over the course of last winter. > Absolutely LOVE the new Daniweb... Thanks! It's nice to get feedback, but positive feedback is better for the ego. ;)

Member Avatar for Dani
0
184
Member Avatar for Rashakil Fol

The editor resizes as you edit your post. I've found that it's not perfect and you may end up scrolling a bit in some cases, but it does at least attempt grow and shrink to fit the content.

Member Avatar for Dani
1
423
Member Avatar for Dani

I see three potential alternatives: 1. Keep the live preview, but let us toggle it with a check box (and remember the choice). 2. Keep the live preview, but let us toggle it with a profile option. 3. Ditch the live preview in favor of a preview request (perhaps in …

Member Avatar for Dani
0
335
Member Avatar for silvercats

> (1) means that there was something wrong. While 1 can be an error code, the whole point of using 0 to signify success is because there's only a single success value but a large number of potential error values: anything in the range of int that's *not* zero. So …

Member Avatar for silvercats
0
874
Member Avatar for webdesigner65

[Click Me](http://net.tutsplus.com/tutorials/php/how-to-create-a-phpmysql-powered-forum-from-scratch) The concept of a discussion forum is actually pretty simple, and a bare bones forum system is equally simple. Adding in other features, scalability, compatibility, and security are what take up the lion's share of effort. If you have any specific questions about how Daniweb in particular works …

Member Avatar for webdesigner65
0
330
Member Avatar for MasterHacker110

You don't clear `command` anywhere in that snippet. If it's not cleared anywhere else, then I'm not surprised that the previous data remains. After each iteration of the outer loop you can just say `command.clear()` to make it empty.

Member Avatar for MasterHacker110
0
243
Member Avatar for gerbil

> I'd like to respond to a poster, but i get a red warning about a code snippet being not correctly formatted. There is no code in my post, just some log references and a URL. I think that's due to a perceived indentation, which is matched as a false …

Member Avatar for Dani
0
271
Member Avatar for daydie

> It has just come to my attention that he has indeed used this for spam. He is also using it for profit too. > > Would this not be considered a breach of forum rules? It's soundly in the gray area as far as self-promotion goes, but I think …

Member Avatar for Begginnerdev
0
172
Member Avatar for TrustyTony

In your case (being a moderator with unlimited edit permissions), I'd say just keep a running update on the code for the snippet and make sure to include an easily seen comment in the message that says the code snippet is evolving. You might also link to the thread in …

Member Avatar for TrustyTony
0
230
Member Avatar for sparsh610

It depends on what you're looking for. The same question might be asked about string comparisons, or array comparisons, or binary search tree comparisons. However, typically a comparison means comparing corresponding items. So you'd traverse both lists and compare the data in each node. When they don't match, you return …

Member Avatar for deceptikon
0
72
Member Avatar for WaltP

The problem was the {...} delimiters in the post. It looks like Dani added a code validation rule to account for weaknesses in the editor's highlighting algorithms, and it explicitly disallows braces for some reason. I'm not sure what the reason is, as we've disabled the only place in Markdown …

Member Avatar for Dani
0
241
Member Avatar for sparsh610

> But there is no way to traverse a singly linked list backwards. Incorrect, and if you had read this thread more carefully you'd see at least two replies (one from mike_2000_17 describing the process and one from Schol-R-LEA with sample code) showing an easy way of doing what you …

Member Avatar for mike_2000_17
0
852
Member Avatar for Remy the cook

In C++ you can certainly pass an array directly by reference: #include <iostream> using namespace std; void foo(int (&a)[10]) { for (int i = 0; i < sizeof a / sizeof *a; ++i) { cout << a[i] << '\n'; } } int main() { int x[10] = {0, 1, 2, …

Member Avatar for Remy the cook
0
235
Member Avatar for Psyho

func() must be a member function of the class type for xx and return an object or reference to itself so that the the same member function can be called on the result. One example might look like this: #include <iostream> using namespace std; class Foo { int _value; public: …

Member Avatar for mike_2000_17
0
254
Member Avatar for Perry31

Um...what? What do you mean by "get name mangling". Name mangling is an internal method for compilers to differentiate between otherwise similarly named objects. It's not something you as the end programmer need to care about except as pertains to disabling it for C compatibility.

Member Avatar for Perry31
0
169

The End.