He's Black Hat Guy because he's downloading videos from YouTube. (I don't actually know if such channels exist—I've never looked for them—but it seems like the sort of thing that probably would exist.)

By the way, I count at least 11 problems with the code (12 if you count it all being in upper-case, but I did in fact type it all in the correct case, it's just the font; and of course there may be more, since I didn't test it). (And lack of "return 0;" isn't one of them; end of §3.6.1, page 62.)

chridd wrote:By the way, I count at least 11 problems with the code (12 if you count it all being in upper-case, but I did in fact type it all in the correct case, it's just the font; and of course there may be more, since I didn't test it). (And lack of "return 0;" isn't one of them; end of §3.6.1, page 62.)

That many?I count

Spoiler:

- The two already mentioned- no std:: before calls to std functions. - missing newlines- You don't flush your output to cout- there's a semicolon after the last if- the || in the first if (very nice. Such a logical mistake)- a hard enter inside a string literal (though that could be due to formatting. So I wouldn't normally count that as an error on printed code)

What are the other three?

It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist- Bernard Woolley in Yes, Prime Minister

- Semicolon after one of the ifs [edit] never mind, you already had that one and I didn't see it [/edit]- "=" instead of "==" (instead of strcmp) in one of the ifs- Unicode directional quote marks- "Copy-and past"- No fallback else case- No newline before the opening brace ( )- The hard enter inside a string literal is a real bug - if you click the "Transcript" link you can see it's there in the unformatted text.

Also, the missing std::endls and not flushing are really the same item, because std::endl flushes the output for you.

- Semicolon after one of the ifs [edit] never mind, you already had that one and I didn't see it [/edit]- "=" instead of "==" (instead of strcmp) in one of the ifs- Unicode directional quote marks- "Copy-and past"- No fallback else case- No newline before the opening brace ( )- The hard enter inside a string literal is a real bug - if you click the "Transcript" link you can see it's there in the unformatted text.

Also, the missing std::endls and not flushing are really the same item, because std::endl flushes the output for you.

Spoiler:

Wow, completely missed the single = and unicode code marks. So easy to overlook those kinda issues. I saw the missing else of course, but that's not really a programming error, more a style issue (and maybe a UX issue. But the entire program is one big UX horror).

'Missing newlines' and 'not flushing' are not the same error, unless you always do newlines with std::endl, in which case you deserve to be slapped.

It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist- Bernard Woolley in Yes, Prime Minister

cout automatically flushes when the stream initializer is destroyed and when cin is asked for input. And ending your program with a newline is a choice, just like having no final else. [edit] oh darn, I forgot about the multiple outputs at the start that mustn't go on one line. Alright, there are missing newlines. [/edit]

Oh, right, I missed that one when counting. (I think that was an actual unintended typo...)

Flumble wrote:So left on the list are:

Spoiler:

no std::

wrong quotation marks

no newlines between cout/cin calls

no initialization of source

char* comparison with ==

wrong use of ||

using = instead of == for comparison

typo in "copy-and past"

semicolon after if condition

You missed the linebreak in the middle of the string.

Some hints for the last two:

Spoiler:

• there's a quirk that cin >> has that would make all these comparisons fail if they worked as intended.• the last one's more a major design/user experience issue, rather than something in one specific place in the code

Ah, oops, I thought that was dismissed as a line-wrap. (I'd like to back it up with "but the syntax highlighting", but the highlighting is wrong already because of the other bug)

chridd wrote:Some hints for the last two:

Spoiler:

• there's a quirk that cin >> has that would make all these comparisons fail if they worked as intended.• the last one's more a major design/user experience issue, rather than something in one specific place in the code

Ouch, that is one cheeky bug. (well, perhaps it's dull and expected by someone who actually works with C++, but to me it's sly)@phlip correct

Oh, right, it like stops at the first whitespace or something, doesn't it?

I straight-up never use cin>> or scanf or any of that whole variety of input methods because I know they never actually do what you want, but as a result I kinda forget the details...

Exactly! Back when I was first learning C++, I only knew about cin >>, so that's a problem that I've encountered.

I'm with phlip. I've never in my life used cin, and I don't expect I ever will, so I've never bothered to learn its specifics.

That entire program is kind of ridiculous. Why would you ever make your users type out string literals in response to a query that's basically "select from a list". The only use case for that is something like making a user type out a full "YES" before reformatting an entire disk drive, and even in cases like that you wouldn't make the user type out an entire sentence without showing the sentence to be typed somewhere on the screen.

It's one of those irregular verbs, isn't it? I have an independent mind, you are an eccentric, he is round the twist- Bernard Woolley in Yes, Prime Minister

Diadem wrote:That entire program is kind of ridiculous. Why would you ever make your users type out string literals in response to a query that's basically "select from a list". The only use case for that is something like making a user type out a full "YES" before reformatting an entire disk drive, and even in cases like that you wouldn't make the user type out an entire sentence without showing the sentence to be typed somewhere on the screen.

...and that's basically the last of the 11 13 problems with the code (that it makes users type long, exact phrases with no indication anywhere what the possible phrases are, and gives no indication what went wrong if you don't).

Named the original universe and its first alternate "Universe A" and "Universe 1", respectively. Labeled the rest by number, such as Universe #6. (One "exception": Universe XVII.) Rarely wrote numbers on the boxes. Displayed it in white text on-screen without the '#', generally. See: