#include<conio.h>

#include<conio.h>

작성일 2024.03.25댓글 1건
    게시물 수정 , 삭제는 로그인 필요

#include<stdio.h>
#include<conio.h>
void bubblesort(int v1[], int n);
void main()
{
   int m[10]={2,4,5,6,8,9,1,10,3,7};
   int n = 10,d;
   bubblesort(m,n);

   for(d=0; d<=9; d++){
    printf("m[%d]=%d \n", d, m[d]);
   }
}
void bubblesort(int v1[], int n)
{
    int i, temp;
    for(n=n-1; n>=0; n-=1){
        for(i=0; i<n; i++){
            if(v1[i]>v1[i+1]){
                temp=v1[i];
                v1[i]=v1[i+1];
                v1[i+1]=temp;
            }
        }
    }
}
위에 #include<conio.h>를 쓰는 이유가 뭔지 궁금합니다. 꼭써야하나요? 안써도 실행결과는 똑같던데  #include<conio.h>를 쓸 때는 언제인가요??



profile_image 익명 작성일 -

지금 코드에는 conio.h가 없어도 됩니다.

conio.h에는 콘솔을 직접 관리하는

라이브러리 함수들이 선언되어 있습니다.

주로 사용하는 함수는 kbhit와 getch로

표준 입력 버퍼를 통하지 않고

다이렉트로 키 입력을 처리할 수 있습니다.

유닉스, 리눅스 기반이기에 동시 입력은 처리할 수 없습니다.

현재는 효용성이 거의 없기 때문에

초보자들이 매우 간단한 게임 만들 때만 씁니다.

다중 키 입력을 처리하려면 windows.h 등

OS가 독자적으로 제공하는 라이브러리 함수를 써야 합니다.

#include<conio.h>

#include<stdio.h> #include<conio.h> void bubblesort(int v1[], int n); void main() { int m[10]={2,4,5,6,8,9,1,10,3,7}; int n = 10,d; bubblesort(m,n); for(d=0; d<=9; d++){ printf("m[%d]=%d \n...

C언어에서 #include <conio.h> 를...

C언어에서 #include <conio.h> 를 사용하는 이유가 무엇인가요? 또 if문에서 stdio.h 와 conio.h 둘 다 사용하면 에러가 뜨던데 왜 그런가요? #include <stdio.h> 를...

c언어 conio.h 오류

... 그런데 #include <conio.h> 이 문제가 생겨서 이 부분을 바꾸거나 대체하는 것을 알고 싶어요 (//에 있는 부분들은 대체하려고 해봤다가...

c 언어 #include <conio.h>

... [code], #include <stdio.h> #include <conio.h> #include <time.h> #include <stdlib.h> int getnumber(void); void getslot(int []); void print(int []); int main() {int...

c++에서 #include <conio.h> 에러뜨는...

... c++에서 #include <conio.h>를 쓰면 오류가뜨는데 터보c인가 거기서만 쓰는 함수인가요?? #include <conio.h>를 쓰면 에러메시지에 fatal error C1083: Cannot open...

C 언어에서 StdAfx.h와 conio.h라는...

#include <StdAfx.h> #include <conio.h> 이 헤더 파일은 왜 쓰는건지요? 무슨기능을 하는지요? stdafx.h란 파일은 C언어에서 사용되는 표준 헤더 파일이 아닙니다만.. 이...

conio.h 함수

... getch() ->한글자 받는 것 kbhit()->입력이 들어왔다면 예를 들면 #include <stdio.h><CONIO.H> #include <conio.h><STDIO.H> void main(){ while(1)...

[c언어]다음코딩에서 <conio.h>를...

#include<stdio.h> #include<conio.h> void main(){ int i, sum=0; for(i=1;i<=100;i=i+2) sum += i; printf("sum=%d\n",sum); } 위와같은 코딩에서 #include<conio.h>를 기술하지 않아도...

conio.h 와 stdio.h 함께 써도 되요?

... 예를 들어 #include<conio.h> #include<stdio.h> ~~~ ~~ 이렇게 쓰면 conio.h 기능과 stdio.h 기능을 다 사용 할수 있나여? 둘다 쓸 수 있습니다 ^^;; 제가...

C 언어에서#include<iomanip.h>라는...

... 예제 ☞ 조작기 사용 #include<iostream.h> #include<iomanip.h> #include<conio.h> void main(){ int num=220; clrscr(); cout << "The decimal num is " << num << "\n"; // The decimal...