drew said:
I am reading my textbook and doing the code examples in MS Visual C++ 6.0
for my next class beginning Jan 05. The textbook examples show line
numbers. How do I get line numbers to show as I type in the examples? tia
drew
That depends on the program you're editing your code in. None of the
editors I use show the lne numbers beside the code I'm writing (at least not
by default). That's possibly because line numbers are not relevant in C++.
In BASIC, they had meaning, but not in C++. The line number is often
displayed somewhere in the window, usually in a "stutus line" at the bottom
of the screen. But again, that depends entirely upon the editor (IDE) being
used, and what settings you choose for it.
Why do you need the line numbers? Just make your code look like the code in
the book. And remember, C++ does not (in most cases) care about the
formatting of the text. For example, the following code snippets are
identical:
for (int i = 0; i < N; ++i) { if (DoSomething(i)) DoSomethingElseToo(N);
else break; }
and...
for (int i = 0; i < N; ++i)
{
if (DoSomething( i ))
DoSomethingElseToo( N );
else
break;
}
So, line numbers really wouldn't help you much here, right? But if you
really want them, check the documentation for the program you're using to
edit your code, and see if that's an option.
-Howard