mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

People choose it judging and relying on which local distillery it was produced.
If my pal sends me to the shop to buy a bottle he says: don't buy our (from our town) vodka, buy either from Minsk or Brest's.

That's very much like beer in Germany. I lived there for a year and when my friends want to know what the best german beer is, it's hard to tell, cause, in Germany, you rarely drink a beer that wasn't brewed somewhere in a 20km radius from the bar you're in. Every town's got its local beer(s) and it's almost blasphemous to drink anything else.

I was just asking about vodka cause people always associate Russia with vodka, and I never found a russian / old-eastern-bloc vodka that I liked, compared to swedish, finnish or balt vodkas. But I remember trying some Minskaya Krystall at one time, and it was pretty decent.

I'm all of ready to answer any of them.

A friend of mine from Romania told me a bit about growing up in the Soviet era school system. Did you grow up in that too? And what was that like?

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Playing to the stereotypes: What's the best brand of vodka?

nitin1 commented: excellent question!! ;) +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

but i never say anyone about my awesome and fabulous source is. ;)

You are reaping the benefits of a community of people who find that it is important to share knowledge and help others to improve, and are generous enough to take the time to do so. Then you turn around and keep that knowledge and resources to yourself. Not cool, man.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@Reverend Jim

Very true, but each cigarette that led to the addicted state was a choice. Each dollar I spend foolishly that gets me further into debt is a choice. It doesn't matter that each cigarette and each dollar gets me into a deeper hole that gets harder and harder to climb out of. Each step is a choice.

As we would say in French, that train of thought leads you to the tip of your nose, but no further. I don't understand your obsession at making that point. If anything, it is a trivial point that means nothing. Except for automated actions like breathing in and out, or making your heart beat, everything anyone does is a choice. A statement like "each step is a choice" is literally saying "each action is an action", a completely worthless point to make, let alone insist on. It is the reasons for making the choices that you make that are worth discussing.

If your point is about owning responsibility for your situation or something like that, then you should make that point with clear language rather than vague and meaningless sound-bites.

I have friends in medical research who have told me that heroin withdrawal is not as severe as portrayed on TV and the movies. They say that in most cases the physical symptoms are pretty much the same as a severe bout of flu.

I've heard that too, just like having a really bad fever for a …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I guess you can get books on Linux networking and system administation. Like:

For a free reference on system administration:
Linux Network Administrator's Guide (free online)

For a more all-around guide to Red Hat (one of the most popular distro for servers):
"A Practical Guide to Red Hat Linux" - Mark Sobell.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Your copyTree function only performs a "shallow copy", meaning that you just copy the "root" pointer, not the actual tree it points to. You need to do a "deep copy".

In your destroyTree function, you don't check that the left and right pointers are non-NULL before dereferencing them.

I highly suggest you read my tutorial on the topic of writing resource-holding classes in C++.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@AD: That's a screen shot of msys, the MinGW replacement from cmd.exe (command prompt). It is a unix-like bash shell for Windows, like cygwin. That's the standard way to run MinGW/GCC in command-line (unless you want to suffer and use the command prompt).

@Vastor: The problem I see on the screenshot is that you are using a DOS-style address of the folder, but msys (or cygwin) uses Unix style. In other words, you entered cd C:\Users\mat, but, in Unix style, it should be cd /c/Users/mat. That's all. It might be good to for you to know a few basic Unix shell commands.

There shouldn't be an access rights problem here, since you are the user "mat", and if there is, it will display a message saying that. It is usually preferable to avoid user directories in Windows, they are a mess of access restrictions and convoluted symbolic links.

Vasthor commented: thank you very much. +2
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Glad you figured it out. For a more complete understanding, I suggest you read the relevant parts of the C++ Standard: Section 3.1 "Declarations and Definitions", and Section 7.1.1 "Storage Class Specifiers".

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

In this code:

    copy->left->root = copyTree(otherTree->left->root);     
    copy->right->root = copyTree(otherTree->right->root);

Where do you allocate the memory that copy->left and copy->right point to? Are you sure that neither of otherTree->left or otherTree->right are NULL?

In this code:

delete root; //Will recursively delete all nodes below it.

"Will recursively delete all nodes below it", how so? I don't see a destructor for the class Tree_Node that deletes the left and right branches.

You have a lot of work to fix this up, my friend.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

It's not a disease any more than hitting yourself in the head repeatedly with a hammer is a disease.

Hitting yourself in the head repeatedly with a hammer is a symptom. Probably of a mental illness of somekind. I think that is the core of the issue. Drug addiction is neither a disease or a defect for the simple reason that it is not a cause, it is an effect or symptom, a mere expression of an underlying disorder. I think the underlying cause is more akin to things we generally classify as personality disorders, like eating disorders (e.g., anorexia) and OCD. These kinds of disorders are very complicated and develop for different reasons, and come at varying degrees of intensity (e.g., some people are just a bit obsessed with cleaning, others are terrified of leaving their house, fearing the dust they'll find on the sidewalk).

But I still cringe when I hear alcoholism described as a disease.

I agree. People label alcoholism or drug addiction as a "disease", "character defect", or even "demonic possession". These all make me cringe because these labels 1) act as a scape-goat ("not my fault, I've got a disease"), 2) divert attention from the true cause (just fighting the symptoms), and 3) creates an "us versus them" mentality (or "sane versus insane"). And I especially hate hearing that religion is the miracle cure for it, as does the AA or Narconon, when all they do is make you feel even …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

In the code you posted, the only error I can spot is this bit:

return temp->value;             //Returns the value of the top node.
delete temp;                    //Deletes the top node in the stack.

You can't have a statement after the return statement. That statement will never execute. You need to do:

elemType tmp_val = temp->value; //Returns the value of the top node.
delete temp;                    //Deletes the top node in the stack.
return tmp_val;

I see nothing fundamentally wrong with your push and pop functions. Your error must be in the copy-constructor, copy-assignment and/or destructor of your BinaryTree class. These can be tricky to implement and you are using plenty of them in the push-pop functions.

Notice how it still prints the newlines but fails to print the text. Even stranger is that the push function comes after the cout, it shouldn't affect it.

This is simply because the text is outputed without a flushing of the standard output. Newlines have the effect of flushing the output buffer (i.e., actually printing it to the screen). Basically, the error occurs before the standard output buffer is flushed on its own (without being explicitly triggered), and because the error message appears on the standard error output, it never actually prints out the text before the end of the program. In the pop case, it is different, because you print something else to the standard output before the error occurs. To fix that little quirk, just use this:


       
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Let's have a look at the C++ Standard, shall we:

Section 17.6.4.3.2/1:

Certain sets of names and function signatures are always reserved to the implementation:
— Each name that contains a double underscore _ _ or begins with an underscore followed by an uppercase letter (2.12) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.

So, the first person was correct. Technically speaking, this only applies to global names (including pre-processor defines of MACROs), but to be on the safe side, you'd better avoid it altogether.

Then someone today said that that advice was 100% wrong and that it was better the first time and that the convention, for configuration / ini files where the user changes the code to allow or disallow options, a leading underscore is used to specify that this is a pre-processor name as opposed to, say, a constant.

There is no wide-spread convention that I know of that prescribes leading underscores for #defines. That guy pulled that out of his ... hat. You might see leading underscores in the standard library implementation provided by your compiler, but that's the point, it is reserved for the "implementation" (which means the compiler and its standard library implementation). You might see that in Boost libraries too, being the anti-chamber for standard libraries, it's just an exception to the rule.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The only real difference between a struct and a class is in the default inheritance and access rights. Given a base-class B, you could write:

class C : B {  // inherits B privately, by default, same as ': private B {'.
  void foo();  // private member function, same as 'private: void foo();'.
};

struct D : B {  // inherits B publicly, by default, same as ': public B {'.
  void foo();   // public member function, same as 'public: void foo();'.
};

Generally, it is not recommended to use the default inheritance or access rights, so you should always spell it out (i.e., have the public or private keywords explicitly stated). With regards to the C++ Standard, there is never any distinction made between a struct or a class (except where it specifies the default rights associated to them), they are both referred to as a class.

In common coding practice and popular terminology, C++ programmers will often say a "structure" for something ressembling a C-style struct (meaning a struct that would be valid in C: no inheritance, only public data members, and no member functions). In formal language (as in the ISO standard document), this is called a POD-type (Plain-Old-Data type). Often, C++ programmers will use the keyword struct when building such a simple class (just a container of a few data members, with only simple and public member functions). But this is nothing more than a convention (and a bit of syntax convenience as POD-types …

np complete commented: nice information +3
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I would say neither.
The two words you've chosen are really bad to describe what addiction is (drug or otherwise). A disease usually implies either a virus or an infection, i.e., some kind of foreign organism (pathogene) spreading in your body. Addiction is nothing like that at all. And the word "defect" is usually associated with something permanent and genetic, like a birth defect. Again, addiction is a behavior that can be learned from others or develops on its own, and can be unlearned or tamed. I find that the tone of the terms you chose to use are pejorative.

At most, addiction is classified as a disorder (and a rather mild one at that). I think that officially drug addiction, specifically, is classified as a "substance use disorder". Personally, I think it's a stupid classification. Besides chemical dependence that some drugs cause (mostly tobacco, cafeine, cocaine, and opiates (heroine, morphine, oxycontin, etc.)), which isn't nearly as strong as people think, the main component of a drug addiction is just the behavioral addiction, which, generally speaking, could involve anything, not just drugs. You can be addicted to sex to the point that it ruins any relationship you try to have, you can be addicted to shopping to the point that it has you go bankrupt, and you can be addicted to a whole lot of other things (some more harmful than others, or less conspicuous than others). I would classify addiction as a personality disorder, that is, in the …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

What do you mean by mature ? Is that means they are excellent programmers ?

I meant "mature" as deceptikon so eloquently put it. Maturity and being an excellent programmer are not correlated by any means. However, an active, veteran member is usually excellent in his/her fields, either as a consequence of hanging around here for a long time or as the reason for coming here, or a little of both.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The parameter pGTPrice is a pointer-to-member-function. And to call the member function it points too, you need to supply an object on which to call it. Within the "GetStars" function, you should use the "this" pointer to address the object you want to call the member function on, you can do that as follows:

int Price = (this->*pGTPrice)();

That should do it.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

is it like vacancies which comes ? like in a big big companies vacancies comes around , is that like this ?

Not really like that, since moderation is mostly voluntary. But yeah, it's basically that the number of mods becomes too few. Some mods may stop being active or as active as before, either because they are too busy or just lost interest, or whatever. Additionally, the activity levels on the forums fluctuate, overwhelming the current mod team. At that point, they think, maybe a few more mods would be useful. That's it. Nothing complicated.

i mean how moderator choose a eligible person ? just nomine is asked, and if he says yes, then he is admin or mod ?

I became a mod last spring. Before that, I had about 2k posts, mostly in C/C++ forums, over about 2 years of fairly regular visits to daniweb. After this kind of time and participation to the forums, you become known by most regular members and mods who hang around in the same forums. They know you, your attitude, and trust you to some extent and respect you (e.g., there are a few outstanding members that if I see that they are responding to a particular thread, then I probably don't need to read that thread or get involved). I don't think that there is any "eligibility criteria" for nomination as a mod, just that when the time comes for a few more mods to be …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The competition period is over (June-July), but you can still vote (see signature).

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

As AD said, there are many alternatives. Doing Win32 API directly is probably the worst option. In a similar style as doing Win32 API directly, you can use SDL, which is at least cross-platform and a bit easier, but still very basic and low-level like Win32 API. On the Microsoft side, one option is MFC, but it is old and is being deprecated by MS (which I think is a good thing, because MFC sucked), and then, there is WinForm (Windows Forms) which is better than MFC but WinForms is basically another name for the GUI part of the .NET platform, meaning you have to use C++/CLI (a hybrid language between C++ and C#) or a .NET-only language (like C#), so you basically have to learn a new language to use it (and the hybridization in C++/CLI is a bit quirky). So, there is no current, decent GUI toolkit in pure C++ offered by Microsoft right now (or there never was, depending on whether you consider MFC to be decent or not). A common practice is to compile the important C++ code into a DLL and call it from the GUI written in another language.

Outside the MS world, there a much nicer alternatives in C++, IMHO. wxWidgets is a popular one, but I have never used it. Ditto for GTK+. Qt is definitely what I recommend, it is cross-platform, easy and intuitive, and all object-oriented, …

sss93 commented: Thanks btw QtCreator works with what compiler ?? +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Why can't we do this in C++? The compiler says it's ambiguous or that the parameter x shadows a member of such and such class.
Is there any tricks to doing this?

The this pointer exists in C++ too (Java copied this feature from C++). You can access the members as this->x or this->y. The compiler is always going to complain about the shadowing of the member by the parameter if they have the same name, just to make sure you are aware that addressing x is not going to address this->x but the parameter. The easiest way to avoid this is to just use a different name for the parameter. Personally, I often just add a "a" in front and use a CamelCase for the parameters, in this case it would be aX. There are other conventions, like putting a trailing underscore for parameters, as in x_.

In the above, they use the this keyword to call another constructor of the exact same class! I read somewhere that it's bad to do this in c++ and that it's better to make a new object and just assign it to the current one. Is this true or can I actually do this in C++?

In C++, it is true that you should never call a constructor directly, and I don't think you would be allowed too, but it is possible through the placement-new syntax. Certainly, you should not call another constructor within one constructor, using …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Main part of my project is to capture and parse all incoming and outgoing network
traffic on the fly. Do you think that merits a performance concern?

Not until you have tested your program and realize that your code is not able to keep up with the data rates. Only then, can you start investigating what performance problems might be the cause of it. That's what deceptikon means by not optimizing prematurely.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Most programming languages and some scripting/interpreted languages have the capability of calling C functions in a DLL or .so file (i.e., a shared library). This is what usually serves as the glue between any two language, and is most often the basis for other frameworks geared towards inter-language interfaces (like COM objects in Windows). If you do this by hand (without the help of a special tool or library), the process is usually as follows:

  1. Write your code in Language 1.
  2. Write a set of C-compatible function (i.e., with a standard calling convention, no name-mangling, only opaque pointers or primitive types as parameters, etc.) in Language 1.
  3. Compile (or encapsulate) the code from steps 1 and 2 into a shared library (or DLL) which exports all the C functions.
  4. Write code in Language 2 that wraps the C function calls into a structure (classes, and functions) that mirror the original code (step 1), but in Language 2.
  5. Link (dynamically) all your Language 2 code with the shared library created in step 3.

For simple applications, the above can be done by hand very easily. For larger applications, it might be very difficult to do it just based on the two languages that you are dealing with (especially being able to do step 4 with fidelity). And, you would normally use an automated tool for this purpose. These tools vary between language combinations, and some consist only of libraries in the destination and/or source language, while some are more involved …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

when I execute the program it gives me random numbers but it has given me anything from 3- 16.... instead of 3-14.

Then, you should use:

return (3 + rand() % 12);

Thanks for your help. I apologize for my poor use of words... it is in fact creating an object on each iteration. :) also I am a she not a he ;) not that it matters anyway... I hope. :)

Glad to help! Sorry for assume you were a "he"... and no it doesn't matter that you're a lady ;) If anything, you'll get more gallantry ;)

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@WaltP:
I think he just mispoke on that sentence, if you read all the posts, especially his original description:

I am using:

DataType *Ptr = new DataType ();

I use this in the beggining of the loop then end the loop with:

delete Ptr;

Each constructor and destructor gets called each time the loop is executed....

I believe it is pretty clear that he is currently doing something like this (and that's how arkoenig interpreted it too):

while(/*...*/) {
  DataType *Ptr = new DataType ();
  // ...
  delete Ptr;
};

He is only making a poor choice of words when describing it. When he says loop, he really means iteration. That's a very common linguistic slip that I'm used to hearing all the time. When he says "in the beginning and end of the loop", there is no way that this can mean the entire loop, he must be meaning to say "in the beginning and end of every iteration of the loop". Don't expect a novice (possibly, second-language writer) to be so rigorous about the words he uses, I think the meaning was obvious here, especially knowing that this particular wrong choice of word is extremely common.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

It is true that the Computer Science forum isn't the most active here. But, as far as I am concerned, and I think others too, I regularly check it. And the only way a forum becomes more active is if people post to it.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

That's the whole point. In C++, local variables (objects) get created at the point where they are declared (i.e., the DataType Obj; statement), and get destroyed at the end of the first enclosing scope (i.e., at the first closing curly-braces). As in this:

while(/* .. some condition .. */) {
  // ... some code..
  DataType Obj;  // the object 'Obj' gets created here.
  // .. .some more code..
}; // the object 'Obj' get destroyed here, before starting the next iteration.

From what I understand of your problem, it seems like the above is a lot more appropriate and easier than doing a new/delete allocation at the beginning and end of the while loop iteration.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

That forum is called "Software Development" -> "Computer Science". That is where you post language-agnostic problems, such as discussions on algorithms and approaches to solve a problem.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The seeding really only needs to occur once in the entire program (at the start). You don't need and shouldn't re-seed in the constructor of that object. Just call the seed once at the start of the main() function, and that's it. Try it, it will work as you want it to.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I just want to point out, there is one example of completely unfettered capitalism (i.e., a perfect "free-market"), it is called drug trafficking. Government has no effective control over that market, it doesn't regulate the workers, the products nor the economics. What is the result? Exactly what Adams Smith predicted, a feudal system of monopolies (drug cartels) where competition is harshly quelled, prices are entirely controlled by the suppliers, the drugs are most often produced in slave labor, and there is a whole bunch of power-drunk incidents and activities like hijacking local authorities and extorsions in local businesses. This is just a glimpse of the horrors of unfettered capitalism. Another interesting case is, of course, Chile, which has been this lab experiment for neo-liberals to try out a "privatize everything and no regulation" strategy. This state has been nothing but miserable failures one after the other, a huge gap between the poor and the rich, and just general mayhem of riots and protests ever since, even as they get tremendous "help" from corporations and foreign investments.

As for N. Korea, has anyone ever seriously suggested that it is a communist state? That's news to me. They might have originally been established with the help of the soviets and chinese (which are themselves just fascist states, as I said earlier), but now it is just this weird and crazy military dictatorship and "necrocracy" (with a dead man as eternal president). In fact, the words "communism" or "socialism" have been banned for …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

The fact that it's human nature to want, means that any full implementation of these systems will fail.

That's very true. I see that argument as a warrant of caution for those who might dream of a total socialist overhaul of society. Most of what we can point to as the main components of a "civilized" society are the things that go against our human nature (at least, the nastier side of human nature):

  • Just grab the money and run: Can't do that.
  • Kill the guy who slept with my wife: Can't do that.
  • Punch the prick who cut in the line: Can't do that.
  • Slap that girl's behind: Can't do that.
  • Tell lies about your products to sell them: Can't do that.
  • Put your kids to work for a little extra drinking cash: Can't do that.
  • ... and so on..

Of course, you can argue that all the above restrictions and laws are destined to be failures, because you'll never be able to eradicate these tendencies. But does it invalidate those restrictions / laws / rules? No. The same goes for socialism. It goes against the tendencies of people to be greedy, to screw people over, to use their power to exploit and corrupt, to collude in order to control the market, and so on. In some domains, like health care, law enforcement, or fire-fighting, if those tendencies are given free reign, people die, and that's why so many civilized western countries have adopted a public …

Reverend Jim commented: Right on! +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Well, it seems you have it solved now. May I suggest you put the calculations of the roots inside the if-else blocks, as so:

descriminant = pow(b,2) - (4 * a * c);
if (descriminant < 0)
{
    real = -b / (2 * a);
    complex = sqrt(descriminant * -1) / (2 * a);
    cout <<"The first Root Value = " << real  << " + " << complex << "i" << endl;
    cout <<"The second Root Value = " << real  << " - " << complex << "i" << endl;
}
else
{
    rootvalue1 = (-b + sqrt(descriminant)) / (2 * a);         
    rootvalue2 = (-b - sqrt(descriminant)) / (2 * a);  
    cout <<"The first Root Value = " << rootvalue1  << endl;          
    cout <<"The second Root Value = " << rootvalue2  << endl;
}

So, this is solved right?

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

As said in your instructions, the real part is calculated as:

double real_part = -b / (2.0 * a);

So, you say you calculated that value, from a = 2, b = 2, and c = 2, and got -2? How can -2 / (2 * 2) == -2? You must have inputted the formula wrong. What code do you have so far?

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Those instructions are pretty detailed. Do you have any specific problem in implementing them? You cannot just say "how do I do it" and expect complete code for it.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

If you want to compute complex numbers, then you should use the <complex> header and use the std::complex<double> type to represent your numbers. However, if you want to avoid it (why?), then you can simply check the value inside the square-root to see if it is negative (thus, leading to an imaginary component if the square root is taken). The sqrt function (when applied to double variables) will produce a NaN if the number is negative (btw, NaN means "Not a Number").

So, simply compute the square-rooted part separately, check it for negativity, and if it is negative than calculate the real and imaginary parts separately. If positive, then just use the code you have now.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Please correct me where I'm wrong.

OK

Every source file compiled is a translation unit.

That's correct. Everything that turns into one object file (.o or .obj) is a translation unit. The compiler only looks at one translation unit at a time, the linker then assembles them.

When I create constants.cpp and include constants.h in it, they both together form a translation unit.

Pretty much. The cpp file that you compile is the translation unit. As for the headers, you have to think of the include-statements as just a "insert file here" mechanism that grabs all the content of the header file and inserts it in place of the include-statement. So, the cpp file and all the headers it includes turn into one massive source file, and that is the translation unit.

Lets say I didn't use extern. It becomes static by default.

For const-variables, yes.

So when I now include constants.h in my several other .cpps,.. will copies of the same variable(stored in separate addresses) be made? Is this what internal linkage is?

Yes. That's what internal linkage means. It means that all the parts of the code in that translation unit will refer to (be linked with) an internal copy of the variable which only exists in that translation unit, and which is not visible to the linker when linking the object files (compiled translation units).

Given that a constant variable can't and won't be changed in …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@rubberman: This thread is in the C++ forum. The struct Student_info is not needed in C++ (it's accepted by compilers, for compatibility with ancient C dialects, but not commonly used). I think you got a bit confused here.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

You have a circular dependency problem. "Container.h" includes "Student_info.h" which includes "Container.h" which includes "Student_info.h" ... In terms of your declarations, you shouldn't need that. In other words, you shouldn't need to include "Container.h" in the "Student_info.h" file. Remove that include statement and your problem should be solved.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@mike (your Project manager?) in the youtube video is a real hottie. I don't think I'd be able to concentrate on what I was doing if she was leading... haha.

A rather juvenile comment if you ask me. Kat is one of the most competent engineers I know, and she used to be an airforce jet pilot. She now works as a system's engineer for one of the largest space contractors in Europe, and is well on her way to becoming an astronaut. You can't really be distracted by her good looks (which she certainly has), not with the amount of concentration, sharpness and professionalism required just to hold a project-related conversation with her. If anything, she has the opposite effect on people.

You projects are way out of my bounds :(

Out of bounds but not out of reach. That's what it means to challenge yourself, to reach outside your boundaries.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

how did you get so much time to do this ?

First, this was in a span of about 13 years (starting when I was 13-14 or so). Second, you have to understand that most of the stuff in phase 1 (toy projects) were sort of half completed and done in a pretty reckless manner. Third, a lot of the toy projects didn't take half as much time as you'd expect, most of them were the kind of thing you can get done in your spare time over a few weeks, with a few more intense periods (e.g., an intense weekend here and there). Fourth, when you enjoy what you do, you're not counting the hours. Fifth, most of the stuff in phase 2 were done either as part of a full-time employment (internship), or as part of a student team project and, if you've ever been a part of one of those, you know it is a super-intense rush to get things done (e.g., in my last student team project, a year-long space-bourne project, in the last 10 days or so, most of us didn't sleep more than 2-3 hours per night, watch the final day here). And finally, anything worth doing takes time and dedication, that's just a fact of life.

didn't have you your curriculum at that time ?

These things are my curriculum. You cannot "have your curriculum" before you start doing things like that, because it is the things …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

It is basically what the lay-person would call Artificial Intelligence. This comes out of the general realization that the key aspect of an intelligent system is its ability to learn, i.e., to adapt and restructure its computational resources to gear them towards solving problems it commonly encounters (is trained to solve). Besides the hyper-parallel structure (i.e., neural-network) of our brains, the determining factor of our intelligence is the ability to form, adapt and restructure cognitive pathways in such a way that they are useful to solve the problems we encounter in everyday life.

So, machine learning is really about developing mechanisms that can extract useful information out of a pile of data, infer second-degree information from that, and use it either to become better at doing the same thing (extract information) or to take actions that are useful towards some kind of goal or task. In practical terms, however, machine learning is really just applied probability theory. There are tons of methods under the umbrella of "machine learning", from simple regressions (fitting curves through data), to state estimation (Markov processes), all the way to reinforcement learning (be trained to solve problems). The practical applications of machine learning mostly include pattern recognition (e.g., recognize faces in a picture, speech recognition, etc.), optimization algorithms, "programming" (not in the sense of "coding" but in its original academic sense, which is to plan the operation of a system (like a manufacturing plant or a mine) in order to optimize the results, this is the …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

your all 3 phases are concentrated towards projects and projects. hey! Can you please share the projects we should take at this age (time) and what all projects you have taken?

If I skim through my old dev-folders in my computer, I get more or less this list of projects (by phase, and more or less in chronological order):

Phase 1: (more or less junior-high to high-school, up to maybe first half of undergraduate studies) (also, most of these things were never really completed, but at least the core of it was done)

GUI-based Calculator (Visual Basic)
Text-based RPG game (TI-83 assembly) (during boring math classes in high-school)
Transparent Notepad (Delphi & VCL)
Code-line Counter (Delphi & VCL)
Encrypted Archiving Program (Delphi & VCL) (kinda like a Winzip program, but for a home-made encryted archive format)
3D DNA Visualization Program (Delphi & OpenGL)
Started a 1st 3D Rendering & Game Engine (Delphi & OpenGL) (called it "Linak")
3D Skating game (Delphi & OpenGL) (never went very far with that)
3D Model Editor (Delphi, VCL & OpenGL) (never went very far with that)
Started a 2nd 3D Rendering & Game Engine (Delphi & OpenGL) (called it "Element")
Random Landscape Generator Algorithms & Editor (Delphi, VCL & OpenGL)
OpenGL-friendly Font Generator (Delphi, VCL & OpenGL)
Simple FPS Game (Delphi & OpenGL) (running on "Element")
3D Physics Engine and Collision Detector (Delphi) (for "Element")
Software-based Multi-texturing (Delphi & OpenGL) (before video cards could support multi-texturing)
Generalized my Random Landscape Generator to …

I_m_rude commented: eyes are not closing :-O +0
iamthwee commented: Great post, thanks for taking the time to write such detail as well +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

xcode is for MAC, not MS-Windows.

I believe the OP is asking about a cross-compilation environment, such that you can develop code for the iOS under a MS-Windows-based development environment. Personally, I know nothing about doing this, but I just wanted to clarify.

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

while const int may not even be given storage because the compiler may just treat it as if it were a macro by inserting its value wherever it is used.

No, it can't be treated as a macro (substituting for a literal constant), because the const-variable must have an address in memory, i.e., you need to be able to write const int* p = &var; and get a valid address out of that. Literal constants are prvalues, and thus, don't have an address in memory, while const-variables are non-modifiable lvalues, they're different.

In corresponding source, "constants.cpp", I would put const int var = 5;.

This is wrong. In the "constants.cpp", you need to write:

extern const int var = 5;

This is because, by default, a const-variable has internal linkage (i.e., not accessible from other translation units). This means that writing const int var = 5; is equivalent to writing static const int var = 5;, which is inconsistent with the prior declaration (in "constants.h") as an extern.

Then, every source file would get var. (supposedly)
Will source files, that don't #include "constants.h" get access to var?

Every source file that has an #include "constants.h" will have access to that one and unique instance of the const-variable var. In other words, if you print the address of var from each source file, you will get the same value.

If so, how would it possible if there is no link between …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

@Reverend Jim: Although your description is accurate, I find that that "message" is somewhat secondary to the movie, and certainly not what makes it the iconic movie that it is. The movie is really iconic for its very unique psychadelic style. And, it breaks so many of the stereotypes by portraying "ultra-violence" with both sharp and burlesque humour, a thuggish little punk with culture and sophistication, a pure psychopath as a loveable hero and "faithful narrator", all authority figures as completely corrupt baffoons, and so on. The movie is full of revolutionary propositions that make you question a lot of things in a very organic way, which is something a lot of movies sorely lack these days where most blockbusters roll out just peddling the same stereotypes and emotional conundrums (with, at best, very lame and obvious attempts at questioning any pre-conceived ideas). I haven't read the book (not a big reader in general), so I don't know what, if any, of these kinds of things came from the book, but that is certainly the more unique and memorable aspects of the movie, and Kubrick's genius in rendering this to the screen. In any case, "c'est un incontournable", as we say in French (for lack of a proper translation).

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Just share that what have you all done in your universities/scholl time which made you to come to this level of programming.

For programming, the University / School part was mostly irrelevant, I only ever took a few programming courses and they were all compulsory courses (as part of engineering curriculums there are usually a few introductory programming or numerical methods courses) that I took long after I was already more than proficient in programming. Don't think that university courses will teach you to be a programmer. They might teach you to be a good computer scientist, or even a software engineer (although, I'm very skeptical of that), but not a programmer. Programming is more akin to a craft, and is only learn as such, like other "crafts" like being a blacksmith or plumber, you learn by doing it a lot, filling your bag of tricks, taking example on more experienced people or mentors, and with lots of time.

I would describe my experience getting to where I am in three phases:

Phase 1 (formative years, and having fun):
Taking the analogy of becoming a plumber, this phase would be the years when you nag your dad to go with him to work (as a plumber) and do simple plumbing work, for fun.
By and large, what made me come to this level of programming was challenging myself constantly. Starting in teenage years is the best, you combine the capacity to be excited and passionate about …

I_m_rude commented: hats off! it's really valuable whosoever will read it. ;) +0
np complete commented: Nice read for young coders like me :) +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

You must love western movies. It's bit too classic for me. I wasn't even born yet when that love came out.

Neither was I, and my parents still had pimples. I wasn't born yet when that one came out, nor when "Scarface" came out, nor when "The Godfather: Part II" came out, nor when "One Flew Over the Cuckoo's Nest" came out, nor when "A Clockwork Orange" came out, nor when the whole Star Wars trilogy came out. Yet, those are some of the best movies ever made, and not having seen them would be a gapping hole in your popular culture (you can't even understand the references in cartoons like the simpsons or family guy, or just when people talk to you, if you don't know your classics). Doesn't matter when you were born.

And I'm not at all a particular fan of westerns, only the Sergio Leone ones ("A Fistful of Dynamite", "The Good, the Bad and the Ugly", and "Once Upon a Time in the West"), cause these are in a class of their own. And I like his slow, quiet, and incredibly intense movies, punctuated with delicious dialogues, like this one:

Frank: Morton once told me I could never be like him. Now I understand why. Wouldn't have bothered him, knowing you were around somewhere, alive.
Harmonica: So, you found out you're not a businessman after all.
Frank: Just a man.
Harmonica: An ancient race. Other Mortons will be along, …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I watched "A Fistful of Dynamite" yesterday... man, I never get tired of this movie, a timeless classic, like most of Sergio Leone's work.

GrimJack commented: Jame Coburn was my hero - thank you for the reminder +0
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

I am expecting an answer from an kind of a expert who have read multiple books .

The main problem with this is that you don't become an expert by reading books after books on C++ (I think I have maybe read, partially, about 3-4 books on C++, and all were the more advanced books from the "C++ In-Depth" series, i.e., expert-level books). You become an expert by spending years honing the craft. Maybe some of the experts here started their learning journey by reading one of those "beginners" book many years ago, but they have long since moved on. Safe to say, I'm an expert in C++, but I have never read a beginner's book. I started fiddling with programming on another "easier" language (Delphi), and when I switched to C++ (many years ago), a beginner's book was of little use to me.

The best I can do to help you is convey hearsay about recent readers having said "I learn C++ using book X, and it was really good.", and skim through tables of contents or the books themselves and assess whether it seems well written and has the right stuff in it. In that perspective, the C++ Primer (4th or 5th edition) are highly recommended. What you want to look for is who the authors are. You need authors that are knowledgeable, experienced, and have written a lot of such educational material before. In that respect, C++ Primer has a stellar track-record. And, …

mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Here is my two cents from taking a bit of time to skim through most of the major books on C++.

For Beginners

The best I can do to help you is convey hearsay about recent readers having said "I learn C++ using book X, and it was really good.", and skim through tables of contents or the books themselves and assess whether it seems well written and has the right stuff in it. In that perspective, the C++ Primer (4th or 5th edition) are highly recommended. What you want to look for is who the authors are. You need authors that are knowledgeable, experienced, and have written a lot of such educational material before. In that respect, C++ Primer has a stellar track-record. And, of course, the catchier the title, the worse the book is, usually. And, from those criteria, the list gets pretty short (I won't even mention those ridiculous "C++ for Dummies" or "Learn C++ in 21 days" books):

  • "C++ Primer, 5th Edition": Well written, well structured, has lots of examples and exercises, good authors, and no hidden agenda (or programming philosophy to convey), just straight-forward "learn to do stuff" approach.
  • "Accelerated C++": Original in its approach, very to the point, stellar reviews, recommended authors, and very complete. The drawback is that it is getting a bit old now.

Books that are tempting, but not good enough in my opinion:

Ancient Dragon commented: Excellent :) +14
~s.o.s~ commented: Good list +14
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster

Cool, I love mathemagic.