Colours in Graphics.h - GCC - Graphics & Multimedia Lab - C++ Program

Colours in Graphics.h
GCC - Graphics & Multimedia Lab - C++ Program

Source code:
#include<graphics.h>
using namespace std;

int main()
{
    int i,j=1,k=0,gd=DETECT, gm,ych,xch; char* buf;
    
    char colours[18][15]={"BLACK","BLUE","GREEN","CYAN","RED","MAGENTA","BROWN","LIGHTGRAY","DARKGRAY","LIGHTBLUE","LIGHTGREEN","LIGHTCYAN","LIGHTRED","LIGHTMAGENTA","YELLOW","WHITE"};  
    initgraph(&gd, &gm,NULL);
    outtextxy(150,15, "Colours in Graphics.h.");      
    ych=0;xch=0;
     for(i=0;i<8;i++)
      {
       setcolor(i);
    for(j=k;j<k+50;j++)
    {
        line(j+50,80,j+50,200);
    }
    k=j;
    outtextxy(xch+50,80+ych,colours[i]);
    ych+=15;
    xch+=50;
    }
    k=0;ych=0;xch=0;
    for(i=8;i<=15;i++)
      {
       setcolor(i);
 
          for(j=k;j<k+50;j++)
    {
        line(j+50,230,j+50,350);
    }
    k=j;outtextxy(xch+50,235+ych,colours[i]);
    ych+=15;
    xch+=50;
    
    }
    getch();
    closegraph();
    return 0;
}
  
  
Output:
nn@linuxmint ~ $ g++ g5.cpp -lgraph
gp5.cpp: In function ‘int main()’:
gp5.cpp:11: warning: deprecated conversion from string constant to ‘char*’
nn@linuxmint ~ $ ./a.out
a.out: ../../src/xcb_io.c:249: process_responses: Assertion `(((long) (dpy->last_request_read) - (long) (dpy->request)) <= 0)' failed.
Aborted
nn@linuxmint ~ $ 

10 comments:

  1. Great post shared I really need this post your blog is very useful to me. Visit my website to get best Information About Best IAS coaching in Bhandup.
    Best IAS coaching in Bhandup
    Top IAS coaching in Bhandup

    ReplyDelete
  2. Thank you for sharing such detailed Blog. I am learning a lot from you. Visit my website to get best Information About Best UPSC Coaching in Bangalore
    Best UPSC Coaching in Bangalore
    UPSC Coaching in Bangalore

    ReplyDelete
  3. Thank you for sharing such detailed Blog. I am learning a lot from you. Visit my website to get best Information About Top IAS coaching Institutes in Dadar
    Top IAS coaching Institutes in Dadar
    Best IAS coaching Institutes in Dadar

    ReplyDelete
  4. Thank you for sharing such detailed Blog. I am learning a lot from you. Visit my website to get best Information About Top MPSC Coaching Institutes in Andheri
    Best UPSC Coaching Institute in Bhandup
    Top UPSC Coaching Institute in Bhandup

    ReplyDelete
  5. Thank you for sharing such detailed Blog. I am learning a lot from you. Visit my website to get best Information About Best UPSC Coaching Institute in Bhandup
    Best UPSC Coaching Institute in Bhandup
    Top UPSC Coaching Institute in Bhandup

    ReplyDelete
  6. Our company offers a broad range of tests on blood test and other human body viscera. Contact us for more information about our test services.
    lab test near me

    ReplyDelete
  7. This is an awesome post. Really very informative and creative contents. Visit my website to get best Information About Best UPSC Coaching Institute in Mumbai.
    Best UPSC Coaching Institute in Mumbai
    Top UPSC Coaching Institute in Mumbai

    ReplyDelete
  8. Thanks for this post. It proves very informative for me. Great post to read. Visit my website to get best Information About Best UPSC Coaching Institute in Borivali.
    Best UPSC Coaching Institute in Borivali
    Top UPSC Coaching Institute in Borivali

    ReplyDelete
  9. Great post! I really enjoyed reading and found your insights to be quite valuable. I appreciate the way you presented your ideas. It made the content easy to follow and understand. Your writing style is engaging and makes the content enjoyable to read. I look forward to more posts. Thank you for sharing this informative article.If you are interested in knowing about the 10 Best IAS Coaching Centres in Ahmedabad.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...