반응형

Browser support: IE: Internet Explorer, F: Firefox, N: Netscape.

W3C: The number in the "W3C" column indicates in which CSS recommendation the property is defined (CSS1 or CSS2).
BACKGROUND

PropertyDescriptionValuesIEFNW3C
backgroundA shorthand property for setting all background properties in one declarationbackground-color
background-image
background-repeat background-attachment background-position
4161
background-attachmentSets whether a background image is fixed or scrolls with the rest of the pagescroll
fixed
4161
background-colorSets the background color of an elementcolor-rgb
color-hex
color-name
transparent
4141
background-imageSets an image as the backgroundurl
none
4141
background-positionSets the starting position of a background imagetop left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x-% y-%
x-pos y-pos
4161
background-repeatSets if/how a background image will be repeatedrepeat
repeat-x
repeat-y
no-repeat
4141

TEXT
PropertyDescriptionValuesIEFNW3C
colorSets the color of a textcolor3141
directionSets the text directionltr
rtl
6162
letter-spacingIncrease or decrease the space between charactersnormal
length
4161
text-alignAligns the text in an elementleft
right
center
justify
4141
text-decorationAdds decoration to textnone
underline
overline
line-through
blink
4141
text-indentIndents the first line of text in an elementlength
%
4141
text-shadownone
color
length
text-transformControls the letters in an elementnone
capitalize
uppercase
lowercase
4141
unicode-bidinormal
embed
bidi-override
52
white-spaceSets how white space inside an element is handlednormal
pre
nowrap
5141
word-spacingIncrease or decrease the space between wordsnormal
length
6161

FONT
PropertyDescriptionValuesIEFNW3C
font
A shorthand property for setting all of the properties for a font in one declarationfont-style
font-variant
font-weight
font-size/line-height
font-family
caption
icon
menu
message-box
small-caption
status-bar
4141
font-family
A prioritized list of font family names and/or generic family names for an elementfamily-name
generic-family
3141
font-size
Sets the size of a fontxx-small
x-small
small
medium
large
x-large
xx-large
smaller
larger
length
%
3141
font-size-adjust Specifies an aspect value for an element that will preserve the x-height of the first-choice fontnone
number
---2
font-stretch Condenses or expands the current font-familynormal
wider
narrower
ultra-condensed
extra-condensed
condensed
semi-condensed
semi-expanded
expanded
extra-expanded
ultra-expanded
---2
font-style
Sets the style of the fontnormal
italic
oblique
4141
font-variant
Displays text in a small-caps font or a normal fontnormal
small-caps
4161
font-weight
Sets the weight of a fontnormal
bold
bolder
lighter
100
200
300
400
500
600
700
800
900
4141

BORDER
PropertyDescriptionValuesIEFNW3C
borderA shorthand property for setting all of the properties for the four borders in one declarationborder-width
border-style
border-color
4141
border-bottomA shorthand property for setting all of the properties for the bottom border in one declarationborder-bottom-width
border-style
border-color
4161
border-bottom-colorSets the color of the bottom borderborder-color4162
border-bottom-styleSets the style of the bottom borderborder-style4162
border-bottom-widthSets the width of the bottom borderthin
medium
thick
length
4141
border-colorSets the color of the four borders, can have from one to four colorscolor4161
border-leftA shorthand property for setting all of the properties for the left border in one declarationborder-left-width
border-style
border-color
4161
border-left-colorSets the color of the left borderborder-color4162
border-left-styleSets the style of the left borderborder-style4162
border-left-widthSets the width of the left borderthin
medium
thick
length
4141
border-rightA shorthand property for setting all of the properties for the right border in one declarationborder-right-width
border-style
border-color
4161
border-right-colorSets the color of the right borderborder-color4162
border-right-styleSets the style of the right borderborder-style4162
border-right-widthSets the width of the right borderthin
medium
thick
length
4141
border-styleSets the style of the four borders, can have from one to four stylesnone
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
4161
border-topA shorthand property for setting all of the properties for the top border in one declarationborder-top-width
border-style
border-color
4161
border-top-colorSets the color of the top borderborder-color4162
border-top-styleSets the style of the top borderborder-style4162
border-top-widthSets the width of the top borderthin
medium
thick
length
4141
border-widthA shorthand property for setting the width of the four borders in one declaration, can have from one to four valuesthin
medium
thick
length
4141

MARGIN
PropertyDescriptionValuesIEFNW3C
margin A shorthand property for setting the margin properties in one declarationmargin-top
margin-right
margin-bottom
margin-left
4141

margin-bottom

Sets the bottom margin of an elementauto
length
%
4141

margin-left

Sets the left margin of an elementauto
length
%
3141

margin-right

Sets the right margin of an elementauto
length
%
3141
margin-top Sets the top margin of an elementauto
length
%
3141

PADDING
PropertyDescriptionValuesIEFNW3C
paddingA shorthand property for setting all of  the padding properties in one declarationpadding-top
padding-right
padding-bottom
padding-left
4141

padding-bottom

Sets the bottom padding of an elementlength
%
4141

padding-left

Sets the left padding of an elementlength
%
4141

padding-right

Sets the right padding of an elementlength
%
4141
padding-topSets the top padding of an elementlength
%
4141

LIST
PropertyDescriptionValuesIEFNW3C
list-styleA shorthand property for setting all of the properties for a list in one declarationlist-style-type
list-style-position
list-style-image
4161
list-style-imageSets an image as the list-item markernone
url
4161
list-style-positionSets where the list-item marker is placed in the listinside
outside
4161
list-style-typeSets the type of the list-item markernone
disc
circle
square
decimal
decimal-leading-zero
lower-roman
upper-roman
lower-alpha
upper-alpha
lower-greek
lower-latin
upper-latin
hebrew
armenian
georgian
cjk-ideographic
hiragana
katakana
hiragana-iroha
katakana-iroha
4141
marker-offsetauto
length
172

Dimension
PropertyDescriptionValuesIEFNW3C
heightSets the height of an elementauto
length
%
4161
line-heightSets the distance between linesnormal
number
length
%
4141
max-heightSets the maximum height of an elementnone
length
%
-162
max-widthSets the maximum width of an elementnone
length
%
-162
min-heightSets the minimum height of an elementlength
%
-162
min-widthSets the minimum width of an elementlength
%
-162
widthSets the width of an elementauto
%
length
 
4141

Classification
PropertyDescriptionValuesIEFNW3C
clearSets the sides of an element where other floating elements are not allowedleft
right
both
none
4141
cursorSpecifies the type of cursor to be displayedurl
auto
crosshair
default
pointer
move
e-resize
ne-resize
nw-resize
n-resize
se-resize
sw-resize
s-resize
w-resize
text
wait
help
4162
displaySets how/if an element is displayednone
inline
block
list-item
run-in
compact
marker
table
inline-table
table-row-group
table-header-group
table-footer-group
table-row
table-column-group
table-column
table-cell
table-caption
4141
floatSets where an image or a text will appear in another elementleft
right
none
4141
positionPlaces an element in a static, relative, absolute or fixed positionstatic
relative
absolute
fixed
4142
visibilitySets if an element should be visible or invisiblevisible
hidden
collapse
4162

Positioning
PropertyDescriptionValuesIEFNW3C
bottomSets how far the bottom edge of an element is above/below the bottom edge of the parent elementauto
%
length
5162
clipSets the shape of an element. The element is clipped into this shape, and displayedshape
auto
4162
leftSets how far the left edge of an element is to the right/left of the left edge of the parent elementauto
%
length
4142
overflow
Sets what happens if the content of an element overflow its areavisible
hidden
scroll
auto
4162
positionPlaces an element in a static, relative, absolute or fixed positionstatic
relative
absolute
fixed
4142
rightSets how far the right edge of an element is to the left/right of the right edge of the parent elementauto
%
length
5162
topSets how far the top edge of an element is above/below the top edge of the parent elementauto
%
length
4142
vertical-alignSets the vertical alignment of an elementbaseline
sub
super
top
text-top
middle
bottom
text-bottom
length
%
4141
z-indexSets the stack order of an elementauto
number
4162

Pseudo-classes
Pseudo-classPurposeIEFNW3C
:activeAdds special style to an activated element4181
:focusAdds special style to an element while the element has focus---2
:hoverAdds special style to an element when you mouse over  it4171
:linkAdds special style to an unvisited link3141
:visitedAdds special style to a visited link3141
:first-childAdds special style to an element that is the first child of some other element172
:langAllows the author to specify a language to use in a specified element182

Pseudo-elements
Pseudo-elementPurposeIEFNW3C
:first-letterAdds special style to the first letter of a text5181
:first-lineAdds special style to the first line of a text5181
:beforeInserts some content before an element1.582
:afterInserts some content after an element1.582

Different Media Types
Media TypeDescription
allUsed for all media type devices
auralUsed for speech and sound synthesizers
brailleUsed for braille tactile feedback devices
embossedUsed for paged braille printers
handheldUsed for small or handheld devices
printUsed for printers
projectionUsed for projected presentations, like slides
screenUsed for computer screens
ttyUsed for media using a fixed-pitch character grid, like teletypes and terminals
tvUsed for television-type devices
반응형

'Computer_IT > Ajax' 카테고리의 다른 글

WEB 개발용 Debugging Tools  (0) 2008.03.18
JAVASCRIPT 10분 DOM 강좌  (0) 2008.03.09
[JAVASCRIPT] 입력Form ToolTip 샘플  (0) 2006.10.01
[MSDN] XMLHttpRequest  (0) 2006.06.30
[DOM] Accesskey를 이용해 Focus설정  (0) 2006.06.29
반응형
<head>
<link rel="stylesheet" type="text/css" href="파일이름.css" />
</head>
반응형

'Computer_IT > PHP' 카테고리의 다른 글

Fatal error: Class 'SoapClient' not found  (0) 2010.11.08
[javascript] 1초마다 시간 출력  (1) 2006.09.29
[JAVASCRIPT] 해상도 설정 보기  (0) 2006.06.29
반응형
  1. #include <iostream>
  2. using namespace std;
  3. class Student
  4. {
  5. const int id;
  6. int age;
  7. char name[20];
  8. public :
  9. Student(int _id, int _age, char *_name) : id(_id)
  10. {
  11. age = _age;
  12. strcpy(name,_name);
  13. }
  14. void Show()
  15. {
  16. cout << " " << id << endl;
  17. cout << " " << age << endl;
  18. cout << " " << name << endl;
  19. }
  20. };
  21. int main()
  22. {
  23. Student st(2002, 20,"good");
  24. st.Show();
  25. return 0;
  26. }
 
반응형

'Computer_IT > C++' 카테고리의 다른 글

[VC] MMX support 여부  (0) 2006.08.14
Example Program: A Simple Query  (0) 2006.08.07
LinkedList 자료  (0) 2006.04.06
VC++ 단축키 모음  (2) 2006.03.19
Console - 바둑소스  (0) 2006.02.22
반응형

[CODE type="java"]
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.IOException;

public class Grading
{

  private void mCTA()
  {

   BufferedReader br;
   StringTokenizer st=null;
   int i=0;
   int[] iArr= new int[10];

   System.out.print("Input ? ");

   br = new BufferedReader(new InputStreamReader(System.in));         

try
   {

     String str = br.readLine();
     System.out.println("\nInput-value = " + str);
     st = new StringTokenizer(str);
   }
  
   catch(IOException ioex)
   {
     ioex.printStackTrace();
   }

   while (st.hasMoreTokens())
   {
       iArr[i]= Integer.parseInt(st.nextToken());
       System.out.println("iArr[" + i + "]=" +iArr[i]);
       i++;
   }
  
  }

  public static void main(String[] args)
  {
   Grading cta=new Grading();
   cta.mCTA();
  }

}
[/HTML][/CODE]

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

[JAVA5] ActionEvent Example  (0) 2006.09.14
[JAVA] InetAddress  (0) 2006.09.14
JAVA class 정의  (0) 2006.04.12
JAVA에서 Console 문자열 입력받기  (0) 2006.04.05
2차원 배열 생성, 값 배정  (1) 2006.04.05
반응형
  1. <%@ page contentType = "text/html; charset=euc-kr" %>
  2. <head><title> 클라이언트 및 서버 정보</title></head>
  3. 클라이언트IP = <%= request.getRemoteAddr() %> <br>
  4. 요청정보길이 = <%= request.getContentLength() %> <br>
  5. 요청정보 인코딩 = <%= request.getCharacterEncoding() %> <br>
  6. 요청정보 컨텐트타입 = <%= request.getContentType() %> <br>
  7. 요청정보 프로토콜 = <%= request.getProtocol() %> <br>
  8. 요청정보 전송방식 = <%= request.getMethod() %> <br>
  9. 요청 URI = <%= request.getRequestURI() %> <br>
  10. 컨텍스트 경로 = <%= request.getContextPath() %> <br>
  11. 서버이름 = <%= request.getServerName() %> <br>
  12. 서버포트 = <%= request.getServerPort() %> <br>
  13. </body>
  14. </html>
반응형

'Computer_IT > JSP' 카테고리의 다른 글

[JSP] URLEncoder  (0) 2006.09.30
[JSP] page redirect  (0) 2006.09.30
[JSP] request method list  (0) 2006.09.30
[JSP] JSP 필수 Directive  (0) 2006.09.30
Calendar 를 이용한 날짜 출력  (0) 2006.04.07
반응형
현실세계의 객체(OBJECT)를 프로그램으로 구현하기 위해 사용
반응형

'Computer_IT > JAVA' 카테고리의 다른 글

[JAVA] InetAddress  (0) 2006.09.14
콘솔입력받아 배열에 넣기  (0) 2006.04.16
JAVA에서 Console 문자열 입력받기  (0) 2006.04.05
2차원 배열 생성, 값 배정  (1) 2006.04.05
swing 자바 Addtion  (0) 2006.04.04
반응형
  1. <%@ page contentType = "text/html;charset=euc-kr" %>
  2. <%@ page import = "java.util.Calendar" %>
  3. <head><title>Calendar 클래스 사용</title></head>
  4. <% Calendar cal = Calendar.getInstance(); %>
  5. 오늘은
  6. <%=cal.get(Calendar.YEAR) %>
  7. <%=cal.get(Calendar.MONTH)+1 %>
  8. <%=cal.get(Calendar.DATE) %> 일 입니다.
  9. </body>
  10. </html>
 
반응형

'Computer_IT > JSP' 카테고리의 다른 글

[JSP] URLEncoder  (0) 2006.09.30
[JSP] page redirect  (0) 2006.09.30
[JSP] request method list  (0) 2006.09.30
[JSP] JSP 필수 Directive  (0) 2006.09.30
JSP request. 들의 메소드  (0) 2006.04.13
반응형
[CODE type="c"]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FILE_NAME "d:\\student.dat"
FILE * fpStd;
typedef struct node NODE;
struct node {
NODE * flink;
NODE * blink;
char id[12];
char name[30];
};
typedef struct anchor ANCHOR;
struct anchor {
NODE * flink;
NODE * blink;
};
ANCHOR anc;
NODE * makeNode(char * id, char * name);
NODE * makeEmptyNode();
void printData(void);
char showMenu();
void enqAft(NODE * newNode, NODE * oldNode);
void enqBef(NODE * newNode, NODE * oldNode);
NODE * findNode(char * id);
void delNode(NODE * node);
int getListSize(void);
void writeFile(void);
void readFile();
void clearList(void);
int main(void) {
 // 1. anchor가 자신의 주소를 가르키게 함
anc.flink = (NODE *) &anc;
anc.blink = (NODE *) &anc;
 char choice;
char input[80];
NODE * newNode;
NODE * tempNode;
char id[12];
char name[30];
 choice = showMenu();
 while (choice != '0') {
  if (choice == '1') {
 
  printf("학생의 정보를 입력하세요 (아이디 이름) : ");
  gets(input); // aaa 홍길동
  sscanf(input, "%s %s", id, name);
  newNode = makeNode(id, name);
   tempNode = findNode(id);
  if (tempNode == NULL) {
   enqBef(newNode, (NODE *)&anc);
  } else {
   printf("%s 아이디는 존재합니다. \n", id);
  }
  } else if (choice == '2') {
   printf("찾으려는 학생의 아이디를 입력하세요 : ");
  gets(input); // aaa 홍길동
  sscanf(input, "%s", id);
   newNode = findNode(id);
   if (newNode == NULL) {
   printf("%s 아이디는 존재하지 않습니다. \n", id);
  } else {
   printf("학생의 정보를 입력하세요 (이름) : ");
   gets(input); // aaa 홍길동
   sscanf(input, "%s", newNode->name);    
  }

 } else if (choice == '3') {
  printf("찾으려는 학생의 아이디를 입력하세요 : ");
  gets(input); // aaa 홍길동
  sscanf(input, "%s", id);
   newNode = findNode(id);
   if (newNode == NULL) {
   printf("%s 아이디는 존재하지 않습니다. \n", id);
  } else {
   delNode(newNode);
  }
  } else if (choice == '4') {
   printf("찾으려는 학생의 아이디를 입력하세요 : ");
  gets(input); // aaa 홍길동
  sscanf(input, "%s", id);
   newNode = findNode(id);
   if (newNode == NULL) {
   printf("%s 아이디는 존재하지 않습니다. \n", id);
  } else {
   printf("찾을 학생 %s의 정보 : %s, %s\n", id, newNode->id, newNode->name);
  }

 } else if (choice == '5') {
   printData();
  } else if (choice == '6') {
   printf("총 학생의 수 : %d명 입니다.\n", getListSize());
  } else if (choice == '7') {
   writeFile();
  } else if (choice == '8') {
   readFile();
  } else if (choice == '9') {
   clearList();
  } else {
 }
 
 printf("\n<계속 진행하려면 엔터를 치세요 >\n");
 gets(input);
 
 system("cls");
 choice = showMenu();  
}
 return 0;
}
NODE * makeNode(char *id, char *name) {
NODE * newNode = (NODE *) malloc(sizeof(NODE));
strcpy(newNode->id, id);
strcpy(newNode->name, name);
return newNode;
}
NODE * makeEmptyNode() {
NODE * newNode = (NODE *) malloc(sizeof(NODE));
return newNode;
}
void enqAft(NODE * newNode, NODE * oldNode) {
newNode->flink = oldNode->flink;
newNode->blink = oldNode;
 oldNode->flink->blink = newNode;
oldNode->flink = newNode;
}
void enqBef(NODE * newNode, NODE * oldNode) {
newNode->flink = oldNode;
newNode->blink = oldNode->blink;
 oldNode->blink->flink = newNode;
oldNode->blink = newNode;
}
NODE * findNode(char * id) {
NODE * curNode = anc.flink;
NODE * findNode = NULL;
 while(curNode != (NODE *) &anc) {
 if (strcmp(curNode->id, id) == 0) {
  findNode = curNode;
 }
 curNode = curNode->flink;
}
 return findNode;
}
void delNode(NODE * node) {
 node->blink->flink = node->flink;
node->flink->blink = node->blink;
 free(node);
}
int getListSize() {
NODE * curNode = anc.flink;
int count = 0;
 while(curNode != (NODE *) &anc) {
 count++;
 curNode = curNode->flink;
}
 return count;
}

void printData(void) {
NODE * curNode = anc.flink;
 while(curNode != (NODE *) &anc) {
 printf("학생의 아이디 : %s, 이름 : %s.\n", curNode->id, curNode->name);
 curNode = curNode->flink;
}
}
void clearList() {
NODE * curNode = anc.flink;
NODE * tempNode = NULL;
 while(curNode != (NODE *) &anc) {
 tempNode = curNode->flink;
 delNode(curNode);
 curNode = tempNode;
}
}

void readFile() {
fpStd = fopen(FILE_NAME, "r");
 if (fpStd == NULL) {
 printf("파일 열기에 실패함.\n");
} else {
  clearList();
  NODE * newNode = makeEmptyNode();
 while (fread(newNode, sizeof(NODE), 1, fpStd) > 0) {
  enqBef(newNode, (NODE *) &anc);
  newNode = makeEmptyNode();
 }
  fclose(fpStd);
}
}
void writeFile() {
fpStd = fopen(FILE_NAME, "w");
 if (fpStd == NULL) {
 printf("파일 열기에 실패함.\n");
} else {
  NODE * curNode = anc.flink;
  while(curNode != (NODE *) &anc) {
  fwrite(curNode, sizeof(NODE), 1, fpStd);
  curNode = curNode->flink;
 }
  fclose(fpStd);
}
}
char showMenu() {
char choice, dummy;
 printf("************************************\n");
printf("* 1. 학생 추가                      \n");
printf("* 2. 학생 수정                      \n");
printf("* 3. 학생 삭제                      \n");
printf("* 4. 학생 찾기                      \n");
printf("* --------------------------------- \n");
printf("* 5. 학생 목록                      \n");
printf("* 6. 학생 수 출력                   \n");
printf("* --------------------------------- \n");
printf("* 7. 파일 저장                      \n");
printf("* 8. 파일 읽기                      \n");
printf("* --------------------------------- \n");
printf("* 9. 모두 지우기                    \n");
printf("* --------------------------------- \n");
printf("* 0. 종료                           \n");
printf("************************************\n");
printf(">> ");
 scanf("%c%c", &choice, &dummy);
 return choice;
}

[/HTML][/CODE]
반응형

'Computer_IT > C++' 카테고리의 다른 글

Example Program: A Simple Query  (0) 2006.08.07
Const Member변수 초기화 특성  (0) 2006.04.24
VC++ 단축키 모음  (2) 2006.03.19
Console - 바둑소스  (0) 2006.02.22
Console Codepage 설정.  (0) 2006.02.15
반응형

[CODE type="java"]
class Middle2 {
public static void main(String arg[]) throws java.io.IOException{

 char choice;
 String s1="";
 String s2="";
 
 System.out.print("\n첫번째 문자열 입력 : ");
 while ((choice = (char)System.in.read()) != '\n')
 {
  s1 = s1 + choice;
 }
 System.out.print("\n첫번째 정수값 : ");
 System.out.println(s1);

 System.out.print("\n두번째 문자열 입력 : ");
 while ((choice = (char)System.in.read()) != '\n')
 {
  s2 = s2 + choice;
 }
 System.out.print("\n두번째 정수값 : ");
 System.out.println(s2);
 
 }
}

/* 위에서 제공하는 부분 코드를 가지고 중앙값을 구하는 프로그램을 완성하시오 */
[/HTML][/CODE]

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

콘솔입력받아 배열에 넣기  (0) 2006.04.16
JAVA class 정의  (0) 2006.04.12
2차원 배열 생성, 값 배정  (1) 2006.04.05
swing 자바 Addtion  (0) 2006.04.04
연산자 instanceof  (0) 2006.04.01
반응형
[CODE type="java"]
class TwoArray
{
public static void main(String args[])
{
 int two_array[][] = new int[4][5];
 int i,j,k=0;
 
 for(i=0;i<4;i++)
 {
  for(j=0;j<5;j++)
  {
   two_array[i][j] = k;
   k++;
  }
 }
 
 for(i=0;i<4;i++)
 {
  for(j=0;j<5;j++)
   System.out.print(two_array[i][j]+ " " );
  System.out.println();
 }
}
}
[/HTML][/CODE]
반응형

'Computer_IT > JAVA' 카테고리의 다른 글

JAVA class 정의  (0) 2006.04.12
JAVA에서 Console 문자열 입력받기  (0) 2006.04.05
swing 자바 Addtion  (0) 2006.04.04
연산자 instanceof  (0) 2006.04.01
예약어 super  (0) 2006.04.01
반응형

[CODE type="java"]
import javax.swing.JOptionPane;

public class Addition
{
public static void main(String args[])
{
String firstNumber, secondNumber;
int number1, number2, sum;

firstNumber = JOptionPane.showInputDialog("Inter First Integer");

secondNumber = JOptionPane.showInputDialog("Enter Second Integer");

number1 = Integer.parseInt(firstNumber);
number2 = Integer.parseInt(secondNumber);

sum = number1 + number2;

JOptionPane.showMessageDialog(null, "The sum is " + sum, "Result", JOptionPane.PLAIN_MESSAGE);

System.exit(0);
}
}
[/HTML][/CODE]

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

JAVA에서 Console 문자열 입력받기  (0) 2006.04.05
2차원 배열 생성, 값 배정  (1) 2006.04.05
연산자 instanceof  (0) 2006.04.01
예약어 super  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
반응형

[CODE type="java"]
class A { }
class B extends A { }
class C extends B { }

public class instanceofTest
{
public static void main(String args[])
{
 B ob = new B();
 if (ob instanceof B) System.out.println("B의 객체");
 if (ob instanceof C) System.out.println("C의 객체");
 if (ob instanceof A) System.out.println("A의 객체");
 
 A oa = new A();
 if (oa instanceof A) System.out.println("A의 객체");
 if (oa instanceof B) System.out.println("B의 객체");
 if (oa instanceof C) System.out.println("C의 객체");
 
}

}

[/HTML][/CODE]

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

2차원 배열 생성, 값 배정  (1) 2006.04.05
swing 자바 Addtion  (0) 2006.04.04
예약어 super  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006.04.01
반응형

[CODE type="java"]
class C1
{
protected int a = 50;
private int b = 100;
static String x = "파이팅 자바";
void write()
{
System.out.println(x);
System.out.println(a);
System.out.println(b);
}
}


class C2 extends C1
{
String b = "어려운 자바";
String x = "쉬운 자바";
void write()
{
System.out.println(x);
System.out.println(a);
System.out.println(b);
super.write();
}
}


public class SuperTest2
{
public static void main(String args[])
{
C2 o = new C2();
o.write();
}
}

[/HTML][/CODE]

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

swing 자바 Addtion  (0) 2006.04.04
연산자 instanceof  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006.04.01
-- ++ 연산자 테스트  (0) 2006.04.01
반응형

[CODE type="java"]
class C1
{
int a=100;
static String b = "파이팅 자바";
}

class C2 extends C1
{
String b;
String x = "쉬운자바";
}

class Inheritance
{
public static void main(String args[])
{
C2 o = new C2();

System.out.println(o.x);
System.out.println(o.b);
System.out.println(o.a);
System.out.println(C1.b);
}
}
[/HTML][/CODE]

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

연산자 instanceof  (0) 2006.04.01
예약어 super  (0) 2006.04.01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006.04.01
-- ++ 연산자 테스트  (0) 2006.04.01
JAVA 기본 Data타입  (0) 2006.04.01
반응형
오버로딩과 오버라이딩은 서로 혼동하기 쉽지만 사실 그 차이는 명백하다. 오버로딩은 기존에 없는 새로운 메서드를 추가하는 것이고, 오버라이딩은 조상으로부터 상속받은 메서드의 내용을 변경하는 것이다.


오버로딩(Overloading) - 기존에 없는 새로운 메서드를 정의하는 것(new)
오버라이딩(Overriding) - 상속받은 메서드의 내용을 변경하는 것(change, modify)


아래의 코드를 보고 오버로딩과 오버라이딩을 구별할 수 있어야 한다.


class Parent {
    void parentMethod() {}
}

class Child extends Parent {
    void parentMethod() {} // 오버라이딩
    void parentMethod(int i) {} // 오버로딩

    void childMethod() {}
    void childMethod(int i) {} // 오버로딩
    void childMethod() {}       // 에러!!! 중복정의 되었음.(already defined in Child)
}
반응형

'Computer_IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
-- ++ 연산자 테스트  (0) 2006.04.01
JAVA 기본 Data타입  (0) 2006.04.01
Jad - the fast JAva Decompiler  (0) 2006.03.17
반응형
[CODE type="c"]
class unary
{
public static void main(String args[])
{
int ii = 0;

System.out.println(ii++ + ii + ii--);
System.out.println(ii-- + ii);

int jj=0;
System.out.println(++jj + jj + --jj);
System.out.println(--jj + jj);


}
}
[/HTML][/CODE]
invalid-file

download

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006.04.01
JAVA 기본 Data타입  (0) 2006.04.01
Jad - the fast JAva Decompiler  (0) 2006.03.17
반응형

[CODE type="c"]
public class DataTypeTest
{
public static void main(String args[])
{
System.out.println("1. 16진수값 : " + 0x11);
System.out.println("2. 8진수값 : " + 011);
System.out.println("3. 십진수값 : " + 111);
System.out.println("4. 2.0f / 3.0f = " + 2.0f / 3.0f);
System.out.println("5. 2.0 / 3.0 = " + 2.0 / 3.0);
System.out.println("6. 2/3 = " + 2/ 3);
System.out.println("7. 지수형 데이터 3.14159e-3 = " + 3.14159e-3);
System.out.println("8. 이진형 데이터 값 : " + true + (10 > 20));
System.out.println("9. 특수문자값 : \\ \"");
System.out.println("10. 유니코드값 : \u004a \u004f");
}
}

[/HTML][/CODE]


invalid-file

Download

반응형

'Computer_IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006.04.01
-- ++ 연산자 테스트  (0) 2006.04.01
Jad - the fast JAva Decompiler  (0) 2006.03.17
반응형

Visual C++ 단축키 모음

일반 Editor 에서…
Ctrl + Space : 인텔리센스 출력
Ctrl + F5 : 빌드 후 프로그램 실행
F5 : Debugging 모드로 작동
F9 : Break Point
Ctrl + F2 : 북마크
F2 : 북마크로 이동
F10 : Debugging 모드로 작동하되 엔트리 포인트부터 시작
Ctrl + F10 : Debugging 모드로 작동하되 커서의 위치까지
Alt + F8 : 들여쓰기 정리
Ctrl + Shite + Space : 현재 가르키고 있는 함수의 매개변수 보기
Alt + B -> E : Clean
Alt + B -> R : Rebuild All
Ctrl + E : 현재 괄호랑 맞는 괄호를 찾아준다.
Alt + F7 : Project Setting
Ctrl + H : 바꿈
Ctrl + F : 찾기
Alt + E -> I : 여러파일에서 찾기
Ctrl + W : 클래스 위자드 (MFC 코딩시에만 사용)
Alt + 2 : output 윈도우
Alt + 0 : Workspace 윈도우

Debug 모드 작동중
F10 : Step Over (다음줄로)
F11 : Step Into (함수 안으로 들어감)
F5 : 다음 BreakPoint 까지 작동
Alt + 7 : Call Stack 윈도우
Alt + 3 : Watch 윈도우
Shift + F11 : 현재 루틴에서 빠져나온다.
Shift + F5 : 강제로 디버깅 모드 종료

===================================================================================

Ctrl + Tab Edit하고 있는 Child Window 간의 이동
Ctrl + F4 현재 Edit하고 있는 Child Window를 닫기
Ctrl + I >> 문자열 입력 점진적으로 문자열 찾기 (Incremental Search)
Ctrl + F3 현재 커서에 있는 문자열 찾기 (블록 지정 안 해도 됨)
F3 찾은 문자열에 대한 다음 문자열로 이동 (Next Search)
Ctrl + H 문자열 찾아 바꾸기 (Replace)
Ctrl + Left/Right Arrow 단어 단위로 이동
Ctrl + Delete 또는 Backspace 단어 단위로 삭제
Ctrl + F2 현재 라인에 북마크 지정/해제
F2 지정된 다음 북마크로 이동
Ctrl + Shift + F2 지정된 모든 북마크를 해제
F9 현재 라인에 Breakpoint를 지정/해제
Ctrl + Shift + F9 현재 Edit하고 있는 소스파일에 지정된 모든 Breakpoint 해제
Ctrl + ] 또는 E {괄호의 짝을 찾아줌 ({에 커서를 놓고 눌러야 함}
Ctrl + J, K #ifdef 와 #endif의 짝을 찾아줌
Ctrl + L 한 라인을 클립보드로 잘라내기 (Cut)
Ctrl + Shift + L 한 라인을 삭제
Alt + Mouse로 블록 설정 세로로 블록 설정하기 (마우스로)
Ctrl + Shift + F8 세로로 블록 설정하기 (키보드로), 취소할 때는 Esc키를 눌러야 함
블록 설정 >> Tab 선택된 블록의 문자열을 일괄적으로 들여쓰기(Tab) 적용
블록 설정 >> Shift + Tab 선택된 블록의 문자열을 일괄적으로 내어쓰기 적용
Alt + F8 >> Tab 또는 Shift + Tab 들여쓰기 자동 조정 (Tab:들여쓰기, Shift + Tab : 내어쓰기)
Ctrl + T 현재 커서에 있는 변수/함수에 대한 Type이 Tooltip 힌트 창에 나타남
Ctrl + Alt + T 멤버 변수/함수 목록에 대한 팝업 창이 나타남
Ctrl + Shift + T 공백/콤마/파이프/괄호 등을 기준으로 좌우 문자열을 Swap시킴
Ctrl + Shift + 8 문단기호 표시/감추기 : Tab은 ^, Space는 .으로 표시
Ctrl + D 툴바의 찾기 Editbox로 이동
Ctrl + Up/Down Arrow 커서는 고정시키고 화면만 스크롤 시키기

반응형

'Computer_IT > C++' 카테고리의 다른 글

Const Member변수 초기화 특성  (0) 2006.04.24
LinkedList 자료  (0) 2006.04.06
Console - 바둑소스  (0) 2006.02.22
Console Codepage 설정.  (0) 2006.02.15
[펌] Visual C++ Console - 사격게임  (0) 2006.02.15
반응형


자바 class -> java로 다시 디컴파일러 하는 툴...
http://www.kpdus.com/jad.html
반응형

'Computer_IT > JAVA' 카테고리의 다른 글

예약어 super  (0) 2006.04.01
멤버 변수의 상속  (0) 2006.04.01
오버로딩(Overloading), 오버라이딩(Overriding)  (0) 2006.04.01
-- ++ 연산자 테스트  (0) 2006.04.01
JAVA 기본 Data타입  (0) 2006.04.01
반응형
그놈 참.... 재밌는 넘이다.

Vmware workstation 에서 생성된 가상 이미지를 Acrobat Reader 처럼
이미지를 play시킬수 있다.

그러기에 FREE 다.

http://www.vmware.com/download/player/

http://download3.vmware.com/software/vmplayer/VMware-player-1.0.1-19317.exe
반응형

'Computer_IT > OS' 카테고리의 다른 글

[우분투] apt-get  (0) 2007.04.12
mstsc - Remote Desktop Connection Software  (0) 2006.11.17
APM 에서 UTF-8 사용시 손봐야될 파일...  (0) 2006.03.10
무료 디버깅 툴 - ollydbg  (0) 2006.02.16
Linux - Vi editor  (0) 2006.02.15
반응형
APM 에서 UTF-8 사용시 설정해야될 file...


1. Apache 환경파일 편집 (httpd.conf)
2. php 환경파일 편집 (php.ini)
3. mysql 환경파일 편집 (my.cnf)
4. apache, mysql 서비스 재시작
5. mysql에서 캐릭터셋 확인 및 디비생성
6. php 소스코드에 mysql_query("set names utf8;"); 함수 추가
7. php 소스에 한글문자열이 있으면 파일저장할때 UTF-8 파일형식으로 저장
8. 웹브라우즈의 보기-인코딩-UTF-8로 선택
반응형

'Computer_IT > OS' 카테고리의 다른 글

[우분투] apt-get  (0) 2007.04.12
mstsc - Remote Desktop Connection Software  (0) 2006.11.17
VM Player...  (0) 2006.03.10
무료 디버깅 툴 - ollydbg  (0) 2006.02.16
Linux - Vi editor  (0) 2006.02.15
반응형
Console로 프로그래밍된 바둑 소스이다.

출처는 불분명... 어디더라??
  1. #include <stdio.h>
  2. #include <windows.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5. #define LEFT '4'
  6. #define RIGHT '6'
  7. #define UP  '8'
  8. #define DOWN '2'
  9. #define ENTER '5'
  10. #define CLEAR 0
  11. #define NONE 0
  12. #define MAPSIZE 19
  13. #define PLAYER1 1
  14. #define PLAYER2 2
  15. #define PLAY 1
  16. #define START 1
  17. #define END 0
  18. #define NO 0
  19. #define OK 1
  20. #define YES 1
  21. #define OKTOTALCOUNT 4
  22. #define FLAGTRUE 1
  23. #define FLAGFALSE 0
  24. void gotoxy(int x, int y);
  25. int xy[MAPSIZE][MAPSIZE];
  26. int map[MAPSIZE][MAPSIZE];
  27. int x, y, x2 = 2;
  28. int centerX=MAPSIZE/2, centerY=MAPSIZE/2;
  29. int displayX=0, displayLineY=21, displayY=22;
  30. char mapChar[]="┌┬┐├┼┤└┴┘";
  31. void clearValue() {
  32. int x,y;
  33. for(y=0;y<MAPSIZE;y++) {
  34. for(x=0;x<MAPSIZE;x++) {
  35.   map[y][x]=CLEAR;
  36. }
  37. }
  38. }
  39. int IsKill(int cnt) {
  40. return cnt==OKTOTALCOUNT;
  41. }
  42. int TestFlag(int x,int y) {
  43. if(x<0 x>=MAPSIZE y<0 y>=MAPSIZE) return FLAGTRUE;
  44. if(map[y][x]==OK) return FLAGTRUE;
  45. return FLAGFALSE;
  46. }
  47. int SefeDeleteTest(int x,int y,int OtherPlayer) {
  48. int result;
  49. int cnt;
  50. if(x<0 x>=MAPSIZE y<0 y>=MAPSIZE) return OK;
  51. if(xy[y][x]==OtherPlayer) return OK;
  52. if(xy[y][x]==NONE) return NO;
  53. cnt=0;
  54. result=NO;
  55. map[y][x]=OK;
  56. if(TestFlag(x,y-1)==FLAGFALSE) {
  57. if(SefeDeleteTest(x,y-1,OtherPlayer)) {
  58.   cnt=cnt + 1;
  59. }
  60. } else {
  61. cnt=cnt+1;
  62. }
  63. if(TestFlag(x-1,y)==FLAGFALSE) {
  64. if(SefeDeleteTest(x-1,y,OtherPlayer)) {
  65.   cnt=cnt + 1;
  66. }
  67. } else {
  68. cnt=cnt+1;
  69. }
  70. if(TestFlag(x+1,y)==FLAGFALSE) {
  71. if(SefeDeleteTest(x+1,y,OtherPlayer)) {
  72.   cnt=cnt + 1;
  73. }
  74. } else {
  75. cnt=cnt+1;
  76. }
  77. if(TestFlag(x,y+1)==FLAGFALSE) {
  78. if(SefeDeleteTest(x,y+1,OtherPlayer)) {
  79.   cnt=cnt + 1;
  80. }
  81. } else {
  82. cnt=cnt+1;
  83. }
  84. if(IsKill(cnt)){
  85. result=OK;
  86. }
  87. return result;
  88. }
  89. void DolDelete(int x,int y,int OtherPlayer) {
  90. if(x<0 x>=MAPSIZE y<0 y>=MAPSIZE) return;
  91. if(xy[y][x]==OtherPlayer) return;
  92. if(xy[y][x]==NONE) return;
  93. xy[y][x]=CLEAR;
  94. if(x+1<MAPSIZE) DolDelete(x+1,y,OtherPlayer);
  95. if(x-1>=0)      DolDelete(x-1,y,OtherPlayer);
  96. if(y+1<MAPSIZE) DolDelete(x,y+1,OtherPlayer);
  97. if(y-1>=0)      DolDelete(x,y-1,OtherPlayer);
  98. }
  99. void RalDeleteTest(int x,int y,int OtherPlayer) {
  100. clearValue();
  101. if(SefeDeleteTest(x+1,y,OtherPlayer)==YES)
  102. DolDelete(x+1,y,OtherPlayer);
  103. clearValue();
  104. if(SefeDeleteTest(x-1,y,OtherPlayer)==YES)
  105. DolDelete(x-1,y,OtherPlayer);
  106. clearValue();
  107. if(SefeDeleteTest(x,y+1,OtherPlayer)==YES)
  108. DolDelete(x,y+1,OtherPlayer);
  109. clearValue();
  110. if(SefeDeleteTest(x,y-1,OtherPlayer)==YES)
  111. DolDelete(x,y-1,OtherPlayer);
  112. }
  113. void input(int Player) {
  114. char c;
  115.   int LOOP=START;
  116. int OtherPlayer;
  117. if(Player == PLAYER1) {
  118. OtherPlayer = PLAYER2;
  119. } else {
  120. OtherPlayer = PLAYER1;
  121. }
  122.   while(LOOP!=END){
  123. c = getch();
  124. switch(c)
  125. {
  126. case RIGHT:
  127.   x=x+1;
  128.   if(x >= MAPSIZE) x=x-1;
  129.   gotoxy(x,y);
  130.   break;
  131. case LEFT:
  132.   x=x-1;
  133.   if(x < 0 ) x=x+1;
  134.   gotoxy(x,y);
  135.   break;
  136. case UP:
  137.   y=y-1;
  138.   if(y < 0 ) y=y+1;
  139.   gotoxy(x,y);
  140.   break;
  141. case DOWN: 
  142.   y=y+1;
  143.   if(y >= MAPSIZE ) y=y-1;
  144.   gotoxy(x,y);
  145.   break;
  146. case ENTER:
  147.   if(xy[y][x] != NONE ) break;
  148.   xy[y][x]=Player;
  149.   RalDeleteTest(x,y,Player);
  150.   clearValue();
  151.   if(SefeDeleteTest(x,y,OtherPlayer)==YES){
  152.    xy[y][x]=CLEAR;
  153.   } else {
  154.    LOOP = END;
  155.   }
  156. }
  157. }
  158. }
  159. void printScreen(){
  160. system("cls");
  161. int x,y,n;
  162. char c[3];
  163. for(y=0;y<MAPSIZE;y++) {
  164. for(x=0;x<MAPSIZE;x++) {
  165.            if(xy[y][x] == PLAYER1) {
  166.    printf("○");
  167.   } else if(xy[y][x] == PLAYER2 ) {
  168.    printf("●");
  169.   } else if(xy[y][x] == NONE ) {
  170.    n=(x+16)/17+(y+16)/17*3;
  171.    c[0]=mapChar[n*2];
  172.    c[1]=mapChar[n*2+1];
  173.    c[2]=0;
  174.    if((x-3)%6==0 && (y-3)%6==0) {
  175.     strcpy(c,"×");
  176.    }       
  177.    printf("%s",c);
  178.   }
  179. }
  180. printf("\n");
  181. }
  182. gotoxy(displayX,displayLineY);
  183. printf("UP:8  DOWN:2  LEFT:4  RIGHT:6  ENTER:5")
  184. }
  185. int gamePlayCheck(int Player)
  186. {
  187. //승패를 가른다.
  188. return 1;
  189. }
  190. void InitMapData() {
  191. int x,y;
  192. for(y=0;y<MAPSIZE;y++) {
  193. for(x=0;x<MAPSIZE;x++) {
  194.   xy[y][x]=CLEAR;
  195. }
  196. }
  197. }
  198. // 커서를 나타냅니다.
  199. void SetCursorShow(void)
  200. {
  201. HANDLE hConsole;
  202. hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  203. CONSOLE_CURSOR_INFO ci;
  204. GetConsoleCursorInfo( hConsole, &ci );
  205. ci.dwSize=100;
  206. ci.bVisible = TRUE;
  207. SetConsoleCursorInfo( hConsole , &ci );
  208. }
  209. void main() {
  210. int Player=PLAYER1,GamePlayFlag=PLAY;
  211. InitMapData();
  212. SetCursorShow();
  213. clearValue();
  214. printScreen();
  215. x=centerX;
  216. y=centerY;
  217. while(GamePlayFlag!=END){
  218. gotoxy(displayX,displayY);
  219. printf("%d 님이 두실 차례입니다.",Player);
  220. gotoxy(x,y);
  221. input(Player);
  222. printScreen();
  223. if(Player==PLAYER1) {
  224.   Player=PLAYER2;
  225. } else {
  226.   Player=PLAYER1;
  227. }
  228. GamePlayFlag = gamePlayCheck(Player);
  229. }
  230. gotoxy(displayX,displayY);
  231.   printf("%d님의 승리",Player);
  232. }
  233. void gotoxy(int x , int y)
  234. {
  235. COORD Pos = { x*2 , y};
  236. SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE), Pos);
  237. }
 
반응형

'Computer_IT > C++' 카테고리의 다른 글

LinkedList 자료  (0) 2006.04.06
VC++ 단축키 모음  (2) 2006.03.19
Console Codepage 설정.  (0) 2006.02.15
[펌] Visual C++ Console - 사격게임  (0) 2006.02.15
Visual C++ Console 에서 TurboC clrscr 구현  (0) 2006.02.15
반응형
무료 디버깅 툴 ollydbg http://www.ollydbg.de/download.htm  
반응형

'Computer_IT > OS' 카테고리의 다른 글

[우분투] apt-get  (0) 2007.04.12
mstsc - Remote Desktop Connection Software  (0) 2006.11.17
VM Player...  (0) 2006.03.10
APM 에서 UTF-8 사용시 손봐야될 파일...  (0) 2006.03.10
Linux - Vi editor  (0) 2006.02.15
반응형

1. ": set" 으로 변경

  :set ai (autoindeant)
  --> 윗라인과 같이 자동으로 들려쓰기를 해 줍니다.

  :set ts=4 (tabstop)
  --> [tab] 키를 입력 하였을때 이동하는 크기를 조정 합니다.
     (보통 "ts=4" 일때가 가장 적당한 듯 합니다.)


  :set et (expandtab)
  --> [tab] 키를 입력 하였을때 tab에 대당하는 space 만큼 이동 됩니다.
     (Python 언어 코딩 할때 매우 편리 합니다.)


  :set si
  --> 코딩 할때 if, for 같은 것을 입력 하고 다음 라인으로 이동시 들려쓰기를 해줍니다.


  :set sw=4 (shiftwidth)
  --> "set si" 했을 경우 들려쓰기 하는 깊이를 설정 합니다.


  :set encoding=cp949 or utf-8
  --> 작업 하는 컴퓨터 또는 개발 언어에서 기본 인코딩 타입을 설정 할 수 있습니다.


[참고]

* 알고 있겠지만 모든 명령의 취소는 no를 앞에 붙여 주시면 됩니다. 예) :set noai
* 항상 같은 설정이 되도록 하려면 UNIX는 홈디렉토리 아래에 .vimrc 에 넣어 주시구요

  windows 는 vim 설치 디렉토리에 _vimrc 파일에 넣어 주시면 됩니다.

  예)
    set ts=4
    set si
    set ai
    set sw=4
    set encoding=cp494

2. vi 편집 작업시
1) 화면 스크롤

  ^F : 한 화면 앞으로 스크롤
  ^B : 한 화면 뒤로 스크롤
  ^D : 반 화면 앞으로 스크롤
  ^U : 반 화면 뒤로 스크롤
  ^E : 한줄 앞으로 스크롤
  ^Y : 한줄 뒤로 스크롤
  H : 화면의 맨 윗줄로
  M : 화면의 중간 줄로
  I : 화면의 맨 아랫줄로

2) 화면 나누기

  : vs 수직으로 나눔
  : sp 스평으로 나눔
  * 화면간 이동은 ^ww


3) 마크 이동

  m[a~z] --> 현재의 위치를 기록
  '[a~z] --> 기록한 위치로 이동


4) 접기

  V 로 블럭 설정을 한후에 'zf' 하면 접힘
  'zo' 를 하면 다시 펴짐


5) 함수/변수명 자동 완성
  호출 하고자 하는 변수명이나 함수명의 앞글자만 쓰고서 ^p 를 입력 하면 자동 완성 됨


6) 잠시 쉘로 나가기
  ^z, 들어 올때는 fg

반응형

'Computer_IT > OS' 카테고리의 다른 글

[우분투] apt-get  (0) 2007.04.12
mstsc - Remote Desktop Connection Software  (0) 2006.11.17
VM Player...  (0) 2006.03.10
APM 에서 UTF-8 사용시 손봐야될 파일...  (0) 2006.03.10
무료 디버깅 툴 - ollydbg  (0) 2006.02.16
반응형
[CODE type="c"]

BOOL SetConsoleCP(
    UINT wCodePageID  // code page to set
);

[/HTML][/CODE]
반응형

'Computer_IT > C++' 카테고리의 다른 글

VC++ 단축키 모음  (2) 2006.03.19
Console - 바둑소스  (0) 2006.02.22
[펌] Visual C++ Console - 사격게임  (0) 2006.02.15
Visual C++ Console 에서 TurboC clrscr 구현  (0) 2006.02.15
Visual C++ Console에서 TurboC gotoxy구현  (0) 2006.02.15
반응형
출처... 잊어먹었음.
  1. #include < stdio.h >
  2. #include < time.h >
  3. #include < conio.h >
  4. #include < stdlib.h >
  5. #include < windows.h >
  6. /*
  7. * < 사격게임 >
  8. *
  9. * 호환성
  10. * 이 프로그램은 Borland C++ 5.5 에서 컴파일하고 시험되었습니다.
  11. *
  12. * 게임설명
  13. * 사격장은 각각 하나씩의 화살을 포함하고 있는 아홉개의 레인으로 만들어져 있습니다.
  14. * 프로그램이 시작되면 레인의 오른쪽에 한개의 타겟(X)이 나타납니다.
  15. * 당신의 과제는 화살들 중의 하나로 타겟을 맞추는 것 입니다.
  16. * 화살을 쏘려면 레인 번호를 누르면 됩니다.
  17. * 25개의 타겟이 나타난 후에, 게임은 끝나고, 최종점수가 출력됩니다.
  18. *
  19. * 난이도 변경하기
  20. * 난이도를 변경하려면 ShootArrow(int)함수의 두번째 for루프를 변경해서 화살의 속도를 변경하면 됩니다.
  21. * 화살이 천천히 나갈수록 맞추기까지의 시간을 소비하므로 난이도는 높아집니다.
  22. * PlayGame(void)함수의 TIME_LIMIT값을 2초로 맞추어 놓았기 때문에
  23. * 화살이 발사되는데 2초가 걸린다면 게임이 안되죠. 역시 제한시간도 마음대로 수정하세요.
  24. */
  25. #define true 1
  26. #define false 0
  27. typedef int bool;
  28. void ShowScore(int);
  29. int PlayGame(void);
  30. void EraseTarget(int);
  31. void ShootArrow(int);
  32. int ShowTarget(void);
  33. void DrawScreen(void);
  34. void gotoxy(int x, int y);
  35. void clrscr(void);
  36. int main(void) {
  37.   int score;
  38.   srand((unsigned) time(NULL));
  39.   DrawScreen();
  40.   score = PlayGame();
  41.   ShowScore(score);
  42.   return 0;
  43. }
  44. void DrawScreen(void) {
  45.   int x;
  46.   clrscr();
  47.   gotoxy(20, 11);
  48.   printf("게임을 시작하려면 아무키나 누르세요.");
  49.   getch();
  50.   clrscr();
  51.   for (x = 1; x <= 10; x++) {    // 루프는 한번에 한 개의 헤인벽과 한개의 화살을 그린다.
  52.        gotoxy(1, x * 2 + 2);
  53.        printf("-----------------------------------");
  54.        if (x < 10) {
  55.            gotoxy(1, x * 2 + 3);
  56.            printf("%d%s", x, " >>-->");
  57.        }
  58.   }
  59. }
  60. void EraseTarget(int target_position) {
  61.   gotoxy(60, target_position * 2 + 3);
  62.   printf(" ");
  63. }
  64. int PlayGame(void) {
  65.   int score = 0;
  66.   int target_position;
  67.   long start_time;
  68.   bool shot_fired;
  69.   int num;       // 값으로 저장하는 숫자키
  70.   const int TIME_LIMIT = 2// 한 타겟당 제한시간 2초
  71.   int x;
  72.   for (x = 1; x <= 20; x++) {      // 이 루프는 25개의 타겟을 부여한다.
  73.        target_position = ShowTarget();
  74.        start_time = time(NULL);    // 여기에서 시작시간이 저장된다.
  75.        shot_fired = false;
  76.        
  77.        // 제한시간과 남은 화살개수를 알려줌
  78.        gotoxy(44, 2);
  79.        printf("%s%d%s", "남은 화살: ", 21 - x, " ");
  80.        gotoxy(10, 2);
  81.        printf("%s%d%s", "한 타겟 당 시간제한 ", TIME_LIMIT, "초");
  82.        
  83.        do {        // 선수가 사격을 할 때까지 키 입력을 기다린다.
  84.            num = getch() - '0';
  85.            if (num >= 1 && num <= 9) {
  86.                ShootArrow(num);
  87.                shot_fired = true;
  88.            }
  89.        } while (!shot_fired)
  90.        
  91.        // 시간 안에(2초) 타겟을 맞추었을 때 실행된다.
  92.        if ((time(NULL) < start_time + TIME_LIMIT) && num == target_position) {
  93.            putchar('\a');
  94.            ++score;
  95.        }
  96.        EraseTarget(target_position);
  97.   }
  98.   return score;
  99. }
  100. void ShootArrow(int a) {  // 파라미터 a는 발사한 화살의 번호
  101.   int x;
  102.   long delay;
  103.   for (x = 4; x <= 60; x++) {
  104.        gotoxy(x, a * 2 + 3);   // 루프의 매 회마다 화살을 1문자씩 오른쪽으로 움직인다.
  105.        printf(">>-->");
  106.        for (delay = 0; delay < 3999999; delay++) // 이 코드로 화살의 속도조절을 한다. 시스템의 성능에 따라 다르다.
  107.            continue;
  108.        gotoxy(x, a * 2 + 3);
  109.        printf("   ");
  110.   }
  111.   gotoxy(4, a * 2 + 3);
  112.   printf(">>-->");
  113. }
  114. void ShowScore(int score) {
  115.   gotoxy(60, 20);
  116.   printf("-----------------");
  117.   gotoxy(60, 21);
  118.   printf("%s%d", " Your score is ", score);
  119.   gotoxy(60, 22);
  120.   printf("-----------------");
  121. }
  122. int ShowTarget(void) {
  123.   int p = rand() % 9 + 1;      // 이 난수는 타겟이 나타날 레인번호이다. 1 ~ 9
  124.   gotoxy(60, p * 2 + 3);
  125.   printf("X");
  126.   return p;
  127. }
  128. void gotoxy(int x, int y)
  129. {
  130. COORD pos={x,y};
  131. SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
  132. }
  133. void clrscr(void)
  134. {
  135. COORD Cur= {0,0 };
  136. unsigned long dwLen;
  137. FillConsoleOutputCharacter(GetStdHandle(STD_OUTPUT_HANDLE) , ' ', 80*25, Cur, &dwLen);
  138. }
 
반응형

'Computer_IT > C++' 카테고리의 다른 글

Console - 바둑소스  (0) 2006.02.22
Console Codepage 설정.  (0) 2006.02.15
Visual C++ Console 에서 TurboC clrscr 구현  (0) 2006.02.15
Visual C++ Console에서 TurboC gotoxy구현  (0) 2006.02.15
Compiler ...  (0) 2006.02.14
반응형
[CODE type="c"]
void clrscr(void)
{
  COORD Cur= {0,0 };
  unsigned long dwLen;
  FillConsoleOutputCharacter(GetStdHandle(STD_OUTPUT_HANDLE) , ' ', 80*25, Cur, &dwLen);
}
[/HTML][/CODE]

화면 모두 지우기
반응형

'Computer_IT > C++' 카테고리의 다른 글

Console Codepage 설정.  (0) 2006.02.15
[펌] Visual C++ Console - 사격게임  (0) 2006.02.15
Visual C++ Console에서 TurboC gotoxy구현  (0) 2006.02.15
Compiler ...  (0) 2006.02.14
확장열(Escape Sequence) 표기  (0) 2006.02.14
반응형

[CODE type="c"]

void gotoxy(int x, int y)

{
  COORD pos={x,y};

  SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}

[/HTML][/CODE]

반응형

'Computer_IT > C++' 카테고리의 다른 글

[펌] Visual C++ Console - 사격게임  (0) 2006.02.15
Visual C++ Console 에서 TurboC clrscr 구현  (0) 2006.02.15
Compiler ...  (0) 2006.02.14
확장열(Escape Sequence) 표기  (0) 2006.02.14
Console Windows창 Title 바꾸기  (0) 2006.02.14
반응형

[CODE] #pragma comment(lib, "mylib.lib") #pragma comment(lib, "winmm.lib") [/CODE]

컴파일시 lib파일 포함...

반응형
반응형

[CODE type="c"]
\a    0x07   벨 소리

\b    0x08   백 스페이스

\t     0x09   탭

\n    0x0a  개행

\x##  0x##  16진 코드

\###  0###   8진 코드

\\   0x5c  백슬레쉬

\'     0x27  홑따옴표

\"     0x22  겹따옴표

\?     0x3f  물음표

[/HTML][/CODE]

반응형

'Computer_IT > C++' 카테고리의 다른 글

Visual C++ Console에서 TurboC gotoxy구현  (0) 2006.02.15
Compiler ...  (0) 2006.02.14
Console Windows창 Title 바꾸기  (0) 2006.02.14
Console 환경 전용 API 함수  (0) 2006.02.14
#define, #ifdef, #endif  (0) 2006.02.14

+ Recent posts