검색을 해 보셨으면 찾으실 수 있습니다.
검색의 생활화!
http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_tip&no=338
위의 URL에서 표준 C++과 C++Builder에서 사용되는 방식이 각각 있습니다.(리플 참조)
오늘도 건승을 빕니다.
이섭 님이 쓰신 글 :
: #include <stdio.h>
:
: int to_binary(int n);
:
:
: void main()
: {
: int binary;
: char str[500];
: char c;
: char *ch;
:
: printf("Enter the Code : ");
: scanf( "%s \n" , &str);
: printf("Enter the Code : ");
: scanf("%d ",&c);
:
: while(str != NULL ) {
: printf("Enter the Code : ");
: scanf("%d", & *ch);
:
: binary = to_binary(c);
: printf("%d",binary);
: *ch ++;
: }
: }
:
: int to_binary(int *ch) {
: int r;
: r = *ch % 2;
:
: if( *ch >= 2)
: to_binary( *ch / 2);
: putchar( '0' + r );
: return 0;
: }
:
: 이렇게 짜 봤는데... 에러는 없고 컴파일은 안되네요.
: 아.. 출력되는 2진수 값은
:
: 00000000 11111111 10010110
:
: 이런식으로 출력 되어야 하는데... 도움 부탁 드리겠습니다 ^^;
|