Actually, you've done quite admirably. My score: 1768.
A couple notes though:
- main returns int:
int main()
- Don't use system("pause") and system("cls"). Here are some good replacements:
void pause() { cout << "Press ENTER to continue..." << flush; cin.clear(); // (assume the user is playing interactively) cin.sync(); // cin.ignore( numeric_limits<streamsize>::max(), '\n' ); } void clearscreen() { for (int i = 0; i < 100; i++) cout << '\n'; cout << flush; }
- Your "a b c d" is off by one space. But I assume this is because you did not use [code] tags to paste your code...
- Use complete sentences and avoid 1337/cellphone speak when writing instructions. Also, you did not give instructions on how to enter the position. The other problem is that if the user enters the wrong answer the program crashes.
You should add a little error checking to validate the user's input, and complain if he enters something wrong. This is a fairly involved subject, so the simplest thing would be simply to wrap everything in a try..catch block and complain if the user enters the wrong thing:
cout<<"Enter the position: "; try { if (!(cin>>x_char)) throw 1; if (!(cin>>y)) throw 1; x=change(x_char); //change char to int if (x < 0) throw 1; skip=check_skip (pos,x,y); //skip step if pos is ' ' } catch (int) { cout << "You must type a letter (A..J) followed by a number (0..9) and then press ENTER.\n"; pause(); skip = 1; }
- To convert the character …