#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
);
}
#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
);
}
'Languages > C Language' 카테고리의 다른 글
함수 포인터, void형 포인터, 포인터 배열과 배열을 가리키는 포인터 (0) | 2011.12.28 |
---|---|
선택정렬 (0) | 2011.12.26 |
Static(정적) 변수 (0) | 2011.12.23 |
재귀함수를 이용한 10진수 -> 2진수,16진수 변환 (0) | 2011.12.22 |