+ 1

Can someone fox the error

##include <iostream> #include <cstdlib> #include <ctime> #include <conio.h> // for _kbhit() and _getch() using namespace std; const int width = 20; const int height = 5; int studentPos = 2; int obstaclePos = width - 1; int score = 0; void initializeGame() { srand(time(NULL)); cout << "Press any key to start the game!" << endl; _getch(); system("cls"); } void draw() { system("cls"); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (i == studentPos && j == 0) { cout << "S"; } else if (i == height - 1 && j == obstaclePos) { cout << "T"; } else { cout << "."; } } cout << endl; } cout << "Score: " << score << endl; } void input() { if (_kbhit()) { switch (_getch()) { case 'w': if (studentPos > 0) studentPos--; break; case 's': if (studentPos < height - 1)

17th Apr 2024, 11:37 AM
Insiya-Godiwala
2 Respuestas
+ 8
your code is incomplete. link it instead of pasting it into the description. describe what it is supposed to do . tag the relevant programming language.
17th Apr 2024, 11:40 AM
Lisa
Lisa - avatar
+ 4
Insiya-Godiwala Understand that Turbo C++ sadly became obsolete decades ago. It used non-standard libraries, so if you try to port the code elsewhere it is likely to fail. In this case, the conio library is not standard. Therefore it will not compile here on Sololearn. https://www.galdin.dev/blog/why-you-shouldnt-be-using-turbo-c/
17th Apr 2024, 3:15 PM
Brian
Brian - avatar