6,741 Posted Topics

Member Avatar for Narue

A fairly complete implementation to provide another perspective on a seemingly simple program.

Member Avatar for Ene Uran
0
146
Member Avatar for Narue

This code demonstrates AVL insertion and deletion. The code was originally written in C by myself a little while back for a tutorial. The translation to Java was fairly trivial, and to add a little excitement I even threw in a few generics. Yes, I'm aware of this line: tree.data …

Member Avatar for easternRAT
2
341
Member Avatar for Narue

Insertion sort, Selection sort, Bubble sort, Shell sort, Quicksort, and Heapsot. All optimized and ready to be experimented with. This is the framework for a Java application that speed tests various sorting algorithms (because there's usually little need to write one's own in production programs). Several popular algorithms were left …

Member Avatar for majestic0110
1
361
Member Avatar for Narue

This quicksort implements the basic recursive algorithm with three improvements. The first improvement is choosing the pivot based on the median of three values in the list to be sorted. This minimizes the chances of a worst case scenario. The second improvement speeds up the algorithm by termination when subfiles …

Member Avatar for Matt Labbé
1
1K
Member Avatar for nateuni

[B]>I feel quite insulted and angry about your comments.[/B] Grow thicker skin. Nobody cares how you feel, nobody cares what your situation is, and everyone will take you at face value. If you look like a leech, you'll be treated like a leech. However, that said I think yellowSnow and …

Member Avatar for mrnutty
0
214
Member Avatar for DdoubleD

The C# and C++ IDEs are written by separate teams and do not correspond in supported features. In other words, if you can't find that feature in the same place as you would find it for the C# IDE, you're SOL. However, you can still do a selection format by …

Member Avatar for DdoubleD
0
143
Member Avatar for dumbncool

[B]>Associativity? I don't even think you got that right if you were trying to say precedence.[/B] Nope. He got it right, but came to the wrong conclusion. ++ and * (dereference) have the same precedence but are right associative, so ++ is indeed performed first. However, one can't forget that …

Member Avatar for Aia
0
150
Member Avatar for LordoftheFly

[B]>I'm relatively comfortable with C++ and am taking a class in C for the >first time. I'm finding it difficult and frustrating to adapt to the new >language. It's kind of like trying to box with a hand tied behind my back.[/B] If you're used to C++ and the benefits …

Member Avatar for LordoftheFly
0
165
Member Avatar for johndory
Re: Heap

>i just am not sure how accurate it is as anybody can edit it. Tutorials aren't any better because you're not sure if the author can rub two brain cells together. You have to assume that it's accurate, or find multiple sources and compare.

Member Avatar for jainrani
0
141
Member Avatar for jeezcak3++

[B]>My goal is to "master" C++.[/B] That's a nice goal, but don't plan on actually attaining it. I doubt there's anyone in the world who's mastered C++. There's just too much involved, too many nuances. But you can certainly be a C++ badass. That's more than possible given a decade …

Member Avatar for thelamb
0
143
Member Avatar for umarmaqsood

[B]>i wanna know as mentioned before the c language is dying[/B] Total BS, but also keep in mind that C is not C++. Neither are dying (or are likely to die in your lifetime). [B]>should i stop and learn something else before its too late.?[/B] If you want to stop …

Member Avatar for gkaykck
0
135
Member Avatar for Nathan Campos

What's wrong with this picture: <J. Random Newbie says>: "Daniweb is a big and good community, but I want you to cater to my whims and add a forum each time I start learning something new because I'm the most important person in the universe. If you do that I'll …

Member Avatar for happygeek
0
147
Member Avatar for savinki

[code=cplusplus] #include <ios> #include <sstream> stringstream convert ( abc ); convert>> std::hex >> i; [/code]

Member Avatar for spidy.venom
0
110
Member Avatar for Ancient Dragon
Member Avatar for jake43

As much as we'd love to help you cheat (not really), piss off. We help people who are willing to put in some effort, not people looking for a quick and easy answer.

Member Avatar for serkan sendur
0
207
Member Avatar for jake43
Re: c++

There seems to be no program yet, so there's nothing to help with. Best of luck to you.

Member Avatar for poncho4all
0
86
Member Avatar for ryancfc

Just out of curiosity, why are you trying to circumvent the access mechanism? Those members are private for a reason, and if you need to access them from outside of the class without a field, something isn't right. However, if you really want to use a pointer to a member, …

Member Avatar for VernonDozier
0
93
Member Avatar for hardya

[B]>However I could [I][not][/I] give precise details of the internal implementation >of the table or say how to access it from client code, so I failed the question.[/B] Then the question itself is invalid. The exact implementation of the vtable mechanism is compiler-specific and how to access it from client …

Member Avatar for Frederick2
0
109
Member Avatar for jephthah
Member Avatar for QuantNeeds

>Try-- >srand( time(NULL) ); How is that supposed to fix the incompatibility of time's return value with srand's parameter? By the way, 0 and NULL are identical in C++. >try using time without ctime Then the declaration would be missing. >ctime has a function called time_t time ( time_t * …

Member Avatar for mrnutty
0
805
Member Avatar for daviddoria

>Would it make sense to add a new forum to separate it? Frankly, I don't think it makes sense. But if it did then it would also make sense to add a new forum for C++/CLI, and for Qt because it seems to be a favorite recommendation for pretty pictures, …

Member Avatar for NicAx64
0
203
Member Avatar for FBI

>C How to Program >C++ How to Program I suppose if you have two C-notes burning a hole in your pocket, you could get those two (last I checked, they were both over $100). Personally, I'm not willing to pay more for two beginner's texts than I did for the …

Member Avatar for tux4life
0
362
Member Avatar for atch

When the hoops you have to jump through to get this kind of behavior through the library are both advanced and somewhat obscure, one wonders what's so hard about manually writing to fout each time you write to cout (or calling a function that does it for you)...

Member Avatar for Narue
0
137
Member Avatar for jephthah

>So is 'some admin chap' going to tell us why Narue left So as not to hurt any feelings, I'll simply say that I've lost interest in Daniweb and the details are personal. My activity has slipped in the last several months (to the point where for the last two …

Member Avatar for shadwickman
0
204
Member Avatar for jephthah
Member Avatar for ~s.o.s~

I'd recommend Canaan as well. From the first two episodes, it's excellent.

Member Avatar for Narue
1
172
Member Avatar for Fuga

>Does anyone else have any comments? It looks a lot like you completely dismissed peter's comments because they didn't sing your praises. That's not exactly going to encourage more people to waste their time on your frail ego. :icon_rolleyes:

Member Avatar for Narue
-1
40
Member Avatar for carobee

It looks like you're all turned around. Usually people write utilities to fulfill a need. You're looking for a problem to solve, which means you don't need a utility and wouldn't use it even if you decided what to write.

Member Avatar for carobee
0
158
Member Avatar for Narue

You are cordially invited to the [B]#daniweb[/B] channel on server [B]irc.daniweb.com[/B], port [B]6667[/B]. We need some new blood to keep the conversations fresh, and what's more fun than chatting with your favorite techies in real-time?

Member Avatar for lllllIllIlllI
0
698
Member Avatar for darkphotn

[B]>Is computer programming worth it?[/B] Yes. Programming is one of the few fields where you can flex your creativity and not starve. Besides, I'd much rather be constantly learning than get into a monotonous rut because my skillset doesn't need to evolve. [B]>employers in California are now asking for 4 …

Member Avatar for jbennet
0
260
Member Avatar for AhmedHussain
Member Avatar for athlon32

[B]>When printing output to a terminal in C++, should i use "\n", or "endl"???[/B] I recommend using '\n'. For the most part, the stream is flushed in the right places by default, so explicitly flushing it yourself is just an extra unnecessary step. [B]>Is one lighter, faster, or industry standard?[/B] …

Member Avatar for athlon32
0
278
Member Avatar for himgar

>at the end of the code just write >getch(); And also include <conio.h>, not forgetting that the conio library functions are absolutely non-standard and your code won't work on many compilers. >then you can only exit the output after pressing ne character. Is it really [B]that[/B] much work to type …

Member Avatar for siddhant3s
0
327
Member Avatar for Lukezzz

[B]>Incr.Add(1);[/B] You use the arrow operator to access members of managed references: [code=cplusplus] Incr->Add(1); [/code]

Member Avatar for Lukezzz
0
84
Member Avatar for sravan953

Ethical or not, we don't answer questions about how to hack. It's against Daniweb's rules.

Member Avatar for Narue
-2
101
Member Avatar for scrappy

>they are required to have different argument lists Or constness for member functions. The following introduces no ambiguity yet the return types and argument lists for the overloaded function are identical: [code] #include <iostream> using std::cout; using std::endl; class test { public: void f() { cout<<"f()"<<endl; } void f() const …

Member Avatar for Ancient Dragon
0
219
Member Avatar for jephthah

[B]>If you don't know it by then, you're too late[/B] Not true. All you need to do is find a bored hacker and you can acquire a program like this: [code=cplusplus] #include <cctype> #include <cstdlib> #include <ctime> #include <fstream> #include <iostream> #include <map> #include <string> #include <vector> namespace { typedef …

Member Avatar for GrimJack
0
184
Member Avatar for MrNoob

[B]>do you advice me to continue with K&R or get another book to continue with ?[/B] If you can handle K&R, I'd recommend going with it as your first weapon. If you can't handle K&R, I always liked "Pointers on C" by Kenneth Reek. I believe it's out of print …

Member Avatar for Tom Gunn
0
378
Member Avatar for Zcool31

Read up on dynamic_cast. It does what you're asking for (keeping in mind that adding new shapes won't be as simple as creating new polymorphic classes), though I'm sure some OOP nazi will wander in and give you an overly complicated design pattern that will also solve the problem. :icon_rolleyes:

Member Avatar for Zcool31
0
231
Member Avatar for Suraj Nayak

Did you do any research before posting here? What did you find and why wasn't it sufficient?

Member Avatar for darkphotn
0
148
Member Avatar for iskhan

The STL doesn't encourage or discourage inheritance. Why don't you ask a more detailed question?

Member Avatar for Narue
0
36
Member Avatar for george_cpp

On current implementations, you'll probably find that the stdio library is faster than the iostream library. The usual recommendation is to try both and use the one that's fastest on your setup, if all you care about is execution performance.

Member Avatar for monkey_king
0
5K
Member Avatar for walter clark

MFC is a library of classes that wrap the Win32 API and make it more convenient to write applications. The .NET framework is a more complete abstraction into a managed environment (rather than a wrapper for a lower level API).

Member Avatar for Stinomus
0
833
Member Avatar for paroshm

This is a case where you can probably get away with overwriting rather than rewriting. Search for your friend's name, then step forward over the whitespace and simply write the new phone number: [code=c] /* Warning: this code was written without the aid of a compiler */ #include <stdio.h> #include …

Member Avatar for Narue
0
111
Member Avatar for Clockowl

Just pass the limit of the stream size type: [code=cplusplus] #include <istream> #include <ios> #include <limits> in.ignore ( numeric_limits<streamsize>::max(), delim ); [/code]

Member Avatar for Narue
0
281
Member Avatar for vishalag

Are you running in the debugger and it's stopping automatically? Or are you stepping through your code and getting this message when you try to step into the function? Your error sounds a lot like missing debug information during the build, not a problem with the code itself. Does the …

Member Avatar for vishalag
0
414
Member Avatar for seemant_sun
Re: Help

Books don't make you a better programmer, practice makes you a better programmer.

Member Avatar for jephthah
1
116
Member Avatar for cougarclaws

When starting out, it helps to always use braces for compound statements. Your loop should look like this: [code=cpluplus] while ( x < y ) { x = x + 1; cout<< x <<'\n'; } [/code] If you don't have the braces, only the first statement will be the whole …

Member Avatar for Narue
0
94
Member Avatar for fdelriog

When you turn on your computer, it does a bunch of stuff, right? POST, loading the OS, logging you in, starting up automatic programs, etc... Constructors have a similar purpose in that they put your objects into an initial ready state. Achieving that state would be cumbersome at best (because …

Member Avatar for sknake
0
127
Member Avatar for mirfan00

[B]>_getch() isn't part of the C++ standard[/B] There's not a portable way to do what the OP wants, so any viable solution will use things that aren't part of the standard. [B]>you can't backspace[/B] That's an easy addition. [B]>and you're using conio.h[/B] See my comment for getch. So far you …

Member Avatar for Narue
0
198

The End.