Error conio no such file or directory là lỗi gì năm 2024

Here's the program..

include

include

include

# define SIZE 4 void generate_answer(int[]); void compare(int[],int[],int *,int *); int main() {int guess[SIZE],answer[SIZE]; int i,n,m,guesses; int number,exact,inexact;

double average; srand(0); guesses=0;

printf("*** Welcome to the MATCH and HIT game***\n"); printf("The computer has selected a 4-digitnumber.\n"); printf("Try to deduce it in 12 rounds of queries.\n"); generate_answer(answer); for(i=0;i

printf("%d",answer[i]); printf("\n");

do {guesses++; printf("Round# %d Please enter your query (4digits):",guesses); while(scanf("%d",&n)!=1||n>9999) {while(getchar() != '\n' ); printf("invalid input\n"); printf("Round# %d Please enter your query (4digits):",guesses); } m=1000; for(i=0;i

{guess[i]=n/m; n%=m; m/=10; } compare(guess,answer,&exact,&inexact); printf("%d hit and %dmatches\n\n",exact,inexact); }while(exact!=SIZE&&guesses<12); if(exact==SIZE) {printf("*****************************… "); printf("CONGRATULATIONS! You won thegame!\n"); printf("******************************…"); } else {printf("*****************************… "); printf("Sorry, out of queries. Gameover!\n"); printf("******************************… " ) ; } getch(); return 0; } void generate_answer(int answer[]) {int i,j,n,dupe=0; for(i=0;ianswer[i]=0; answer[0]=rand()%9+1; for(i=1;i{dupe=0; n=rand()%9+1; for(j=0;jif(n==answer[j]) {j=10; i--; dupe=1; } if(dupe==0) answer[i]=n; } return; } void compare(int guess[],int answer[],int *exact ,int *inexact) {int i,j; int found[SIZE],used[SIZE]; for(i=0;i{found[i]=0; used[i]=0; } *exact=0; *inexact=0; for(i=0;iif(guess[i]==answer[i]) {*exact=*exact+1; found[i]=1; used[i]=1; } if(*exact==SIZE) return; for(i=0;ifor(j=0;jif(i!=j) if(found[j]==0&&used[i]==0) if(guess[i]==answer[j]) {*inexact=*inexact+1; found[j]=1; used[i]=1; } return; }

Cách khắc phục: Phía trước dòng chữ No such file or directory chính là tên tập tin hoặc thư mục bị khai báo sai (stdo.h) và màu đỏ cảnh báo có lỗi của Code::Blocks cũng chỉ ngay dòng lệnh có lỗi (dòng 1). Chúng ta đã tìm ra nguyên nhân sai, bây giờ bạn chỉ cần sửa lại cho đúng tên tập tin được include thôi. Sửa stdo.h thành stdio.h

Kinh nghiệm: click vào +1 hoặc like xem kinh nghiệm xử lý khi gặp lỗi

conio.h is not a standard library header, and the functions it declares are not standard library functions - it's specific to an ancient implementation that isn't used much anymore. If the code you're trying to build uses conio routines like getch(), then it won't build on a Mac.

answered Apr 29, 2021 at 15:39

Error conio no such file or directory là lỗi gì năm 2024

John BodeJohn Bode

121k19 gold badges124 silver badges202 bronze badges

4

I encountered the same situation. My xcode suggested

include instead. I changed accordingly, now it builds.

answered Jun 7, 2022 at 2:00

0

It depends of what compiler are you using. Conio.h is mostly header for MS-DOS compiler, so it can be unavailable in some others packages. If you tried to use getch() as tool to stop console from closing after execution, simply replace it with scanf():

int a;
scanf(%d,a);

Console will close after pressing Enter

answered Apr 29, 2021 at 15:41

2

See here Conio is dead already do not use my friend I have noticed many YouTubers in initial coding use getch() to make your code wait for you to press a key and when pressed it is done but now conio isn't even a part of c/c++ it works in MS-DOS based compiler and turbo-c++ but most of the turbo c++ code turns out erroneous as they use old c/ syntax that is deprecated a long back in the history of development in c/c.

    
# include 

Suggestion : Remove These lines and voila it works Happy Coding!

answered Jan 23, 2022 at 16:57

Error conio no such file or directory là lỗi gì năm 2024

"use this line in main function then we can use conio file int main(int argc, char const *argv[])"

answered Apr 18, 2023 at 6:22

2

The entire form of conio.h is "Console Input & Output." In C programming, the console input and output function is provided by the header file conio.h. Since we learned that the conio.h file has console input/output functions, the GCC compiler does not support it. Thus, we will talk about a few key features that are utilized to hold the screen, clean the screen, and adjust the text's backdrop color. "conio.h" Don't use it. A header file was discovered in Turbo C/C++, which utilizes a 16-bit compiler. However, it isn't available in GCC, thus none of the functions—such as clrscr(), getch(), gets, and cgets—will work with it.