relu 0 Newbie Poster

Hi, I am a beginner in programing so please be patient. I am using Turbo c++ 3.0, and I can't make this little program to work...:( It should display a lightgreen square and after enter it should write a coloured text...The first part works just fine, but the second one not:'(...Where is the mistake?(sorry for my bad english, I hope you understand what I mean:$)And I get no error if I compile:icon_confused:

#include <conio.h>
#include <stdio.h>
#include <graphics.h>
#include <stdlib.h>

int a, b, c;

int main(void)
 {
  int gdriver = DETECT, gmode, errorcode;
  initgraph(&gdriver, &gmode, "");         //here is the BGI path
  errorcode = graphresult();
   if (errorcode != grOk)
    {
     printf("Graphics error: %s\n", grapherrormsg(errorcode));
     printf("Press any key to halt:");
     getch();
     exit(1);
    }
  setcolor(LIGHTGREEN);
  a=0, b=0, c=110;
  for(b=0;b<=100;b++)
  line(a, b, c, b);
  getch();
  textcolor(BLUE);
  textbackground(RED);
  cprintf("TEST\r\n");        //if I put here printf, puts, cout or anything else it  
  closegraph();               //shows the text but it's not coloured
  getch();
  return(0);
 }
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.