banner



How To Change Background Color In C++

  1. #1

    nahz is offline

    Registered User


    Join Date
    Aug 2007
    Posts
    1

    Irresolute the background color

    Is it possible to alter the black color groundwork to a different colour?
    If it is possible may sharing how to do it..

    cheers


  2. #2

    DavidP is offline

    l'Anziano DavidP's Avatar


    Join Date
    Aug 2001
    Location
    Plano, Texas, United states of america
    Posts
    2,743
    well....that is very arrangement specific to be honest. There is not one standard way to do it.

    Windows, Mac Os X, and Linux all take shells where you tin can physically change the background color options by selecting some kind of "preferences" menu (slightly varies depending on the Bone).

    But I know that'due south not what you desire to know...you want to know how to do it in your program.

    If you are using Windows/DOS: lots of older compilers came with a not-standard header file called dos.h that you could use to exercise some DOS specific stuff, including change the groundwork color I believe...merely well-nigh likely you lot won't have that file, and and then that probably won't piece of work.

    Nigh probable you lot will have to employ some sort of system() command to be able to practise it...but I am not familiar with what the command would really be....

    My Website

    "Round logic is good because it is."


  3. #3

    ssharish2005 is offline

    Registered User ssharish2005's Avatar


    Join Date
    Sep 2005
    Location
    Cambridge, Britain
    Posts
    1,732

    Code:

    #include <stdio.h>  int main() {     /* Some listing of combinations            0 = Black      1 = Blueish      2 = Green      iii = Aqua      iv = Red      v = Majestic      6 = Yellow      7 = White      8 = Greyness     9 = Light Blue     A = Light Greenish     B = Light Aqua     C = Light Red     D = Light Regal     E = Light Yellow     F = Bright White */          printf("This is a console color change program\n");     system("COLOR F2"); /* This will change the bgcolor F - White and textcolor to 2- Dark-green */           getchar();     return 0; }
    This lawmaking is more specific to DOS . It works fine on DOS 5.1.2600 version

    ssharish2005


  4. #4

    brewbuck is offline

    Officially An Builder brewbuck's Avatar


    Join Engagement
    Mar 2007
    Location
    Portland, OR
    Posts
    7,398

    Quote Originally Posted by ssharish2005 View Post

    This code is more specific to DOS . It works fine on DOS 5.1.2600 version

    Dare I fifty-fifty ask why yous're running DOS 5?


  5. #5

    robwhit is offline

    Registered User


    Join Date
    Oct 2001
    Posts
    2,129

    Quote Originally Posted past brewbuck View Post

    Dare I even inquire why you lot're running DOS five?

    maybe the unparalleled privilege settings?


  6. #6

    matsp is offline

    Kernel hacker


    Join Engagement
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    fifteen,677
    "DOS v.one.2600" looks suspiciously liek the version of Windows XP SP2 to me. My Win2K shows "5.0.2195" when I do "ver" in a command prompt. I'm pretty darn sure in that location wasn't a "five.1.2600" version of MS-DOS (or PC-DOS for that matter).

    --
    Mats


Source: https://cboard.cprogramming.com/c-programming/92512-changing-background-colour.html

Posted by: alvarezhourgen39.blogspot.com

0 Response to "How To Change Background Color In C++"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel