Consider my post in this thread...

https://www.daniweb.com/programming/software-development/threads/508038/how-to-change-this-program-to-fully-oop

Consider this code...

int main() {
    srand(time(NULL));
    char enter;

    // game starts
    Player player;

    // title
    cout << "Welcome to Zombie War." << endl << "Press [ENTER] to start.";
    cin.get();

    // player name
    cout << "Please enter your name: ";
    cin >> player.playerName;

    // ask how many zombies
    cout << "How many zombies do you wish to fight? ";
    cin >> player.zombieCount;

    cout << "Get ready to fight for your life, " << player.playerName << "!" << endl;

Line 5 above ("game starts" comment) is line 19 in the OP's code since I took out lines 1 through 14 of the OP's code since it was not relevant to the point I was making here. Is there any way for posters to specify a start line (in this case line 15) so that the line numbers math up? This comes up often. It's handy to be able to do so (ie "compare your lines 20 to 25 to my line 20" as opposed to having to mention that my line 20 is actually labeled as line 6 and I am trying to point out that I replaced their lines 20 to 25 with a single line.

In addition, is there a way to specify a language (or no language) or not to use any line numbers? That's useful in fine-tuning posts and highlighting keywords (for example I may be making a point by having "string" in C and C++ code and pointing out that "string" has meaning in C++, but not C, and how the compiler handles that). Parsing/highlighting that can make it very obvious, but I see no option to do that. I see C++ color context highlighting in the thread linked, but I imagine that that is because it is tagged "C++" and thus code will be interpretted as C++.

Usually a good guess, but not always. Why have the parser guess when it can know for sure? I recall with BBCode you could specify a language or specify no language. Can I override that default parsing in certain cases (ie as mentioned, intentionally posting non-C++ code in a C++ thread as a compare/contrast. I don't want "struct" color highlighted as a keyword if it is not a keyword in the language I am posting). Also I want NO highlighting if it is pseudocode.

Markdown syntax is not as flexible as BBSCode but it is much easier to use, especially for edits-after-the-fact - as anyone who had to do word processing in the pre-wysiwyg days can confirm.

If you need to reference line numbers in code that you are including in a post, my suggestion is to create the post, with the code, and leave line number references as xx or some other marker. Submit the post, then do a page refresh. This will display the post in its final form. Then make a note of the actual line numbers and re-edit the post to replace the markers (you will have a 30 minute window after the first submit to do this). It's a little awkward but should give you what I think you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.