Groups | Search | Server Info | Login | Register
Groups > alt.comp.lang.c++.misc > #8
| From | "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++, alt.comp.lang.c++.misc, free.test |
| Subject | Re: ASCII Codes |
| Date | 2024-09-08 14:37 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <vbl5fb$22ejs$1@dont-email.me> (permalink) |
| References | <Q%nDO.343686$8jx2.215799@fx17.iad> <87h6ap3k6s.fsf@nosuchdomain.example.com> |
Cross-posted to 3 groups.
On 9/8/2024 2:32 PM, Keith Thompson wrote:
> Student Project <student@invalid.invalid> writes:
>> This one works as expected but there is definitely a room for
>> improvement. :-)
>>
>> #include <iostream>
>> #include <vector>
>>
>> using namespace std;
>
> I suggest dropping this and using `std::vector`, `std::string`,
> `std::cout` explicitly. It's a bit more typing, but IMHO it makes the
> code clearer.
>
>> int main()
>> {
>> system("color 0A");
>
> This set the console to black background (0) and light green foreground
> (A), but only under cmd.exe on Windows.
>
>> system("cls");
>
> This clears the screen, but only on Windows.
>
> Both of these needlessly limit the portability of your program.
>
> On a system that doesn't have "color" and "cls" commands, the calls to
> system() will fail silently and do nothing, which is probably ok.
>
> But why would you want to clear the screen and change the foreground and
> background colors anyway? Why is that part of the desired behavior of
> your program?
>
> If I want to run a program that displays data on my screen, I'm going to
> be seriously annoyed if it erases *my* existing data and messes with my
> foreground and background colors.
[...]
Applesoft Basic Online:
https://www.calormen.com/jsbasic/
Back to alt.comp.lang.c++.misc | Previous | Next — Previous in thread | Next in thread | Find similar
ASCII Codes Student Project <student@invalid.invalid> - 2024-09-08 20:45 +0000
Re: ASCII Codes Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-09-08 14:32 -0700
Re: ASCII Codes "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-09-08 14:37 -0700
Re: ASCII Codes "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-09-08 14:39 -0700
Re: ASCII Codes Chris Ahlstrom <OFeem1987@teleworm.us> - 2024-09-09 09:41 -0400
Re: ASCII Codes red floyd <no.spam.here@its.invalid> - 2024-09-09 21:44 -0700
Re: ASCII Codes Bonita Montero <Bonita.Montero@gmail.com> - 2024-09-09 14:32 +0200
Re: ASCII Codes Ben Bacarisse <ben@bsb.me.uk> - 2024-09-09 13:44 +0100
Re: ASCII Codes Chris Ahlstrom <OFeem1987@teleworm.us> - 2024-09-09 09:43 -0400
Re: ASCII Codes Bonita Montero <Bonita.Montero@gmail.com> - 2024-09-09 18:52 +0200
Re: ASCII Codes Student Project <student@invalid.invalid> - 2024-09-10 01:04 +0100
Re: ASCII Codes Bonita Montero <Bonita.Montero@gmail.com> - 2024-09-10 10:32 +0200
Re: ASCII Codes Paavo Helde <eesnimi@osa.pri.ee> - 2024-09-10 07:55 +0300
csiph-web