#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

void gotoxy(int x, int y);
void blue();
void red();
void white();
void textcolor(int i);

int main(int argc, char *argv[])
{
      red();
      gotoxy(10,2); //10열 2행
      printf("hi\n");
     
      int i;
      for(i=0; i<=15; i++)
      {
       textcolor(i);
       printf("testing\n");       
      }


//      system("cls");   
  system("PAUSE");   
  return 0;
}


void gotoxy(int x, int y)
{
 COORD Pos={x - 1 , y - 1};
 SetConsoleCursorPosition(
                          GetStdHandle( STD_OUTPUT_HANDLE ), Pos
 );    
}

void blue()
{
 SetConsoleTextAttribute(
                          GetStdHandle( STD_OUTPUT_HANDLE ),
                          FOREGROUND_INTENSITY | FOREGROUND_BLUE
                          );
                        
     
}

void red()
{
 SetConsoleTextAttribute(
                          GetStdHandle( STD_OUTPUT_HANDLE ),
                          FOREGROUND_INTENSITY | FOREGROUND_RED
                          );
                        
     
}
void white()
{
 SetConsoleTextAttribute(
                          GetStdHandle( STD_OUTPUT_HANDLE ),
                          FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE 
                          );
                        
     
}
void textcolor(int i) //0:검정 ~ 15:흰색
{
 SetConsoleTextAttribute(
                         GetStdHandle(STD_OUTPUT_HANDLE), i
                         );
 
}

+ Recent posts