Loads of comments since I last checked, so it took me quite a while to check through them all.
@Framework:
Not too harsh at all. I didn't actually know that you could name them something else as I've seen (int x, int y, int z) used all over in examples. But I learned from Vlad's example that you can easily do that..
Invalid output was discussed earlier in the thread and I've added a while loop to check if the a valid number was entered, otherwise it asks for a new one.
Yes, I am aware that it would be miles better, but that's the way you learn. You write the first thing that comes to your mind when you think how you could check it, then you simplify it. I see after loads of replies on this thread that I've done that one quite badly.
Thanks though, as said earlier, I appreciate every bit of help I can get. The earlier I can fix bad habits, the better..
One question that never got answered. Why would you not use
using namespace std;
? And instead write std:: in front of every cin / cout / endl ?
Wouldn't it be easier to use:
1 2 3
|
using std:cout;
using std:cin;
using std:endl;
|
at the top if you don't want to use the whole namespace? This is just something I read from other threads that discussed this matter. They pretty much said it was preference. But apparently you shouldn't use
using namespace std;
in header files, why is that?