2,898 Posted Topics

Member Avatar for Fame95

Well, you can proceed by elimination. I'm gonna try to explain without giving it all away. Hint 1: In an undirected graph, every edge that is counted on the degree of one node must also be counted in the degree of the other node to which it leads. For example, …

Member Avatar for mike_2000_17
0
282
Member Avatar for Lardmeister

Agreed, those american beers are just sparkly water with a bit of yellow colorant. I'm not a big fan of Heineken either. Here (QC), we have some local beers that are pretty good, mostly Beligium-style beers. I'm also a big fan of German and Danish beers.

Member Avatar for vegaseat
0
192
Member Avatar for trantran

When doing cross-platform work, there isn't really a need to constantly use both or move between two platforms all the time for doing the actual coding, only for compiling and resolving issues. You code on one platform (whichever you prefer), and frequently check that it compiles on your other target …

Member Avatar for trantran
1
314
Member Avatar for FearlessHornet

You should learn about [passing by reference](http://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/). As in: static DATAEDITING_API bool Contains(const std::string& target, const std::string& source); static DATAEDITING_API bool Contains(const std::string& target, const std::vector<std::string>& source); static DATAEDITING_API bool Contains(const std::string& target, const std::string& source, bool sensitive); static DATAEDITING_API bool Contains(const std::string& target, const std::vector<std::string>& source, bool sensitive); And: …

Member Avatar for mrnutty
0
228
Member Avatar for Hey90

One of the better options would be to do this: class Shoe { public: //Constructors Shoe(); Shoe(string Name_, double ShoeSize_, int Number_); //Destructor ~Shoe(); //Getters string getName() const; double getShoeSize() const; int getNumber() const; //Setters void setName(const string& Name_); void setShoeSize(const double ShoeSize_); void setNumber(const int Number_); //Variables string Name; …

Member Avatar for Hey90
0
4K
Member Avatar for Ancient Dragon

The word a$$ either means anus or donkey, so pick whichever you like: "anus-kicking computer" or "donkey-kicking computer". ;) I would also vote against censorship, if it was a democratic decision.

Member Avatar for Reverend Jim
0
179
Member Avatar for <M/>

> So who do you think is going to win? The team that scores more points than the other by the end of the game. -- Captain Obvious

Member Avatar for <M/>
0
89
Member Avatar for <M/>

Exactly a year ago, I bought an Acer laptop with an i7 processor, 8Gb ram, and 1Tb HDD. It was a bargain at the time, and it works great, just a little less powerful than my desktop computer at home (from 2.5 years ago). It's slick, has a full full-size …

Member Avatar for Ancient Dragon
0
79
Member Avatar for phorce

[Here](http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html) is a pretty complete tutorial for Linux. For Mac, it is a Unix-like system like Linux, and so, the tutorial is equally valid for Mac. > (I think it's different in you can't create/import .dll's instead it's .lib). You have wrong, here is how it is: Windows: `.dll` : …

Member Avatar for phorce
0
358
Member Avatar for TonyG_cyprus

> More and more I find that I can no longer assume that the developers and IT specialists I work with have any clue how to do their job. The worst is when the only skill that people develop during a programming course is their skills at finding code on …

Member Avatar for mike_2000_17
2
112
Member Avatar for ConfusedLearner

> On writing to cout, terminate your lines with << endl;, otherwise you won't get your output displayed on the screen before you are asking for the input. That's wrong. `cin` and `cout` are tied together under-the-hood such that asking for input from `cin` automatically triggers a flushing of the …

Member Avatar for mrnutty
0
128
Member Avatar for mrnutty

I guess we also have to specify that the formula is not computed with integer arithmetic. Otherwise, for any integer greater than 1, the division would yield 0, and thus, there would be "billyuns and billyuns" of possibilities too (`2^160` for 32bit unsigned integers). ;)

Member Avatar for mrnutty
0
119
Member Avatar for erogol

What AD suggests is the preferred thing, i.e., passing the libraries and include-paths manually to the command-line, or configure you projects to add your library and include-paths to them. However, you shouldn't put them "anywhere you want", either put them in your home folder or somewhere that isn't a system …

Member Avatar for rubberman
0
6K
Member Avatar for Reverend Jim

> By any chance is Dani developing a way to permenantly close "dead" threads, to prevent spam? No, or at least, it would be extremely surprising. She has made it abondantly clear (mostly in moderator-only discussions) that people contributing to old threads is not only in agreement with the rules …

Member Avatar for Reverend Jim
3
283
Member Avatar for trantran

> So I ask: has anybody ever succeeded in building/loading/using SUCCESSFULLY g++ 4.8 on a Ubuntu computer? Yes. I keep a rolling version of GCC on my computer at all times, i.e., GCC compiled from source obtained from the latest development branch of GCC's svn repository. And most of my …

Member Avatar for trantran
0
437
Member Avatar for ndeniche

"It's not you.. it's me.." "Don't take it personally, but I think you're a <insert insult> ."

Member Avatar for chrishea
0
1K
Member Avatar for lewashby

Or, using `std::stringstream`: std::string toString(unsigned int i) { std::stringstream ss; ss << std::setfill('0') << std::setw(6) << i; return ss.str(); };

Member Avatar for Moschops
0
154
Member Avatar for abbashadwan

Do you have a question? As for the code, there are several problems with it: - The header `#include <iostream.h>` has been deprecated for a long time, it is a pre-standard syntax that some compilers still support today, but it is not standard. The standard libraries do not have a …

Member Avatar for Ancient Dragon
0
232
Member Avatar for lewashby

if ( atoi( argv[1] ) % atoi( argv[2] ) == .33333 ) You misunderstood what the remainder is. The remainder is an integer value, not a fractional value. In other words, `7 % 3` gives `1` because 3 fits two times into 7 and then there is 1 left, that's …

Member Avatar for deceptikon
0
108
Member Avatar for myk45

> Why is there no way in C++ to ensure the safety in this case? Why? Because C++ has an overarching principle of no overhead for what you don't use. In order to be able to do the run-time check that `dynamic_cast` does, the compiler has to add a hidden …

Member Avatar for myk45
0
611
Member Avatar for deceptikon

I remember, early on when learning C++, to be a bit frustrated at limitations of C-style struct initialization and how awkwardly it mixed with C++ classes. But I also remembered letting go of that quite quickly and never really missing it. Now that the rules have been updated to more …

Member Avatar for vijayan121
0
428
Member Avatar for deceptikon

That's a neat code snippet! Wouldn't it be nicer if the `selection` string was set to the given menu item (by name or ordinal) such that you would need to rely on the alternative match-strings for the switch case? In your test case, the alternatives are always an upper- or …

Member Avatar for tinstaafl
2
3K
Member Avatar for <M/>

[This post](http://www.daniweb.com/software-development/cpp/threads/70096/c-books/12#post1857402) is particularly enlightening ;)

Member Avatar for vijayan121
0
221
Member Avatar for <M/>

> What Comes First... The Chicken Or The Egg? Eggs for breakfast. Chicken for dinner. I rest my case.

Member Avatar for <M/>
0
389
Member Avatar for Raisefamous

> Before i was using Borland Delphi, but i would like to switch to something else like VS. If you are familiar with Borland Delphi, it might be easiest to use Borland C++Builder. The problem is that it is not available for free (beyond a 30 day trial). It is …

Member Avatar for tinstaafl
0
299
Member Avatar for <M/>

> Wouldn't everyone be allergic to dust because there is always dust everywhere? Well, I'm not sure that more exposition necessarily means more chance of being allergic to it, otherwise we'd all be allergic to milk by the time we're 5 years old. I'm allergic to house dust too. Whenever …

Member Avatar for <M/>
0
69
Member Avatar for hana.shamsaldeen

> I would find Inverted matrix A ... (A)-1 Like you would in any other language that don't have built-in methods to do so. There are many algorithms for this purpose, each with different properties (efficiency, stability, amplification of round-off errors, etc.) and for different kinds of matrices (general, normal, …

Member Avatar for hana.shamsaldeen
0
278
Member Avatar for sciwizeh

That is a common situation and there are two common solutions to it. But first, it is important to mention to semantics of this. When you give a non-const reference to a constructor, there is a conventional understanding that the reference must remain valid for as long as the object …

Member Avatar for vijayan121
0
2K
Member Avatar for hamza.farooq.7355

I have dealt with Dell crapware before, especially their incredibly stupidly written restoring program. Before, I had a dual boot system with the Windows bootloader as the primary bootloader (chain-loading grub from the Linux partition), and the Dell crapware did some kind of automatic restore point thing that also involved …

Member Avatar for here2serve
0
198
Member Avatar for johnandersen24

You should make the timeFunction function template take a templated parameter as the functor (callable type). Simply put, you could do this: template <typename F, typename T> clock_t timeFuction(F f, T v) { auto start = clock(); f(v); return clock() - start; } Or, more in the style of C++11, …

Member Avatar for mike_2000_17
0
657
Member Avatar for Reverend Jim

That's a really interesting original definition. No wonder it got twisted into meaning a cheap and miserable man. Nobody likes to be told that they are hypocrites, they prefer to say that the guy who points it out is a miserable fool.

Member Avatar for Reverend Jim
2
208
Member Avatar for glen.persson

Hi Glen, and welcome to Daniweb! I am Canadian, and my last name is also Persson. What are the odds, eh? I'm from Quebec, i.e., french-canadian, so I'm used to getting that name messed up all the time, either mistaken for "Pearson" (common english-canadian last name) or for "personne" which …

Member Avatar for falkopartey
0
198
Member Avatar for zenloki

I don't know much about online degrees, but I am a robotics engineer, so I might weight in a bit here. First, you have to watch out when looking up online degrees because there are a lot of fake colleges or university, for-profit colleges and so on. Also, potential employers …

Member Avatar for falkopartey
1
216
Member Avatar for hotelsinger
Member Avatar for BigPaw

> how intelligent are you in dealing with those whose first language isn't English? I have a bit of experience with that (both here and in real life), and English isn't my first language. I was lucky enough to be raised bilingual (French and Swedish), and later learned English (and …

Member Avatar for BigPaw
1
133
Member Avatar for sciwizeh

There are casting operators for shared_ptr called [`static_pointer_cast` and `dynamic_pointer_cast`](http://en.cppreference.com/w/cpp/memory/shared_ptr/pointer_cast). In other words, if you have this code for raw pointers: base* pb; derived* pd = static_cast< derived* >(pb); derived* pd = dynamic_cast< derived* >(pb); then, the equivalent with shared_ptr is the following: shared_ptr< base > pb; shared_ptr< derived > …

Member Avatar for sciwizeh
0
21K
Member Avatar for chinnaACB

You can use `yum` as follows from a terminal: $ sudo yum install some_package Or, you can launch the software center from the main menu and search for the package you want. and, of course, you need internet access.

Member Avatar for mike_2000_17
0
63
Member Avatar for james6754

I second that. Definitely, put that work experience on your CV. Not only does it show that you have not been sitting on behind for five years, it also shows a number of qualities like being hard working, being able to show up on time every day (at least, if …

Member Avatar for mike_2000_17
0
92
Member Avatar for xxwikkixx

The reason is because you **should not** re-seed the random number generator each time. Just seed it with `srand((unsigned)time(0));` once in the entire application, i.e., at the start of the main() function. That will fix the problem. BTW, to print a fixed number of digits with leading zeros, you can …

Member Avatar for vijayan121
0
198
Member Avatar for movielinks
Member Avatar for sblass92

As far as I know, this cannot be done. From a practical point of view, compilers would be required to track in what namespace a particular function a function pointer point to was defined, and I don't think any compiler really does that because there is no real purpose for …

Member Avatar for sblass92
0
2K
Member Avatar for plang007

Make sure to get the most up-to-date version. CodeBlocks just came out with version 12.11 (late november 2012) which includes the compiler GCC version 4.7.1 (the MinGW TDM-GCC distribution) which should work for Windows 8 (at least, according to the website). Other than that, you'd have to try the Clang …

Member Avatar for plang007
0
334
Member Avatar for Tinnin

Easiest/Safest option: Reinstall Linux on the entire system, overwriting WinXP partitions. If you can fairly easily take a backup of all your files (e.g., take a backup of `/home` folder) and put those files on a separate partition (non-windows, non-linux) or on a separate hard-drive (external HDD or pen-drive), then …

Member Avatar for Tinnin
0
200
Member Avatar for myk45

To clarify, Scott Meyer's explanation is as follows: > Because the default version of operator new is a *general-purpose* allocator, it must be prepared to allocate blocks of any size. Similarly, the default version of operator delete must be prepared to deallocate blocks of whatever size operator new allocated. For …

Member Avatar for jjl.
0
220
Member Avatar for lewashby

Well, on my computer, the `vimrc` file is in the `/etc/vim/` directory, and if I do the `ls -l vim*` command, I get the same result. Try this: $ cat /etc/vim/vimrc N.B.: To find a file, it is easier to use commands like these: /etc$ locate vimrc /etc/vim/vimrc /etc/vim/vimrc.tiny /etc$ …

Member Avatar for mike_2000_17
0
127
Member Avatar for triumphost

> Can C++11's Mutexes be used for Inter-Process Communication? In other words, can it be used for shared memory and signalling an event? Yes. But the more important question is: Should mutexes be used for that? **No**. To use a mutex (or pair of mutexes) for this purpose, one could …

Member Avatar for vijayan121
0
6K
Member Avatar for Strange&Evil

> Visual Studio 2012 (November update). > > Way ahead of GCC (the other major contender) in C++11 conformance - Microsoft has implemented almost everything in the standard. > > clang 3.2 with its libc++ is on par with VS 2012; and it is somewhat more mature and stable in …

Member Avatar for mike_2000_17
0
300
Member Avatar for myk45

Technically, yes, you could make the derived class copy-assignable. The intent of the "non-copyable" idiom is to make the class non-copyable for *users* of the class. As an author of a derived class, you can still make it copyable by making a public copy-constructor and a copy-assignment operator. But you …

Member Avatar for myk45
0
314
Member Avatar for md65381

[Here](http://www.linuxjournal.com/content/using-windows-xp-virtualbox-linux) is a good step-by-step tutorial (for Windows XP, but I'm sure you can figure out how to do other versions too). > for the user it should look alike windows but actually performing his applications on linux platform There are actually many versions of Linux that do look or …

Member Avatar for rubberman
0
482
Member Avatar for md65381

[Here](http://www.psychocats.net/ubuntu/virtualbox) is a step-by-step tutorial to install Linux (Ubuntu in the tutorial) inside a VirtualBox on Windows.

Member Avatar for rubberman
0
285

The End.