Простейший код, но работает не так, как хотелось бы. Уже убил полчаса на поиски истины. Если я ввожу одну букву(кроме q), весь цикл повторяется дважды, не спрашивая меня ни о чём. Если две, то цикл while повторяется трижды, не запрашивая меня нажать ENTER. С cin.get, cin.getline та же история. cin не предлагать, т.к. он ждёт, пока не введёшь что-нибудь перед нажатием ENTER. #include <iostream> #include <stdio.h> #include "dice.h" using std::cout; using std::endl; using std::cin; int main(int argc, char *argv[]) { Dice dice[3]; char c; while(true){ cout << "Press ENTER to throw " << Dice::numOfDices << " dices (q for exiting): "; if((c=getchar()) == 'q'){ break; }else{ for(unsigned int i=0; i< Dice::numOfDices; i++) { dice[i].throwNow(); cout << "Dice#" << i+1 << " has " << dice[i].getCurrentNumber() << endl; } } } return 0; } /* Press ENTER to throw 3 dices (q for exiting): :) Dice#1 has 4 Dice#2 has 3 Dice#3 has 3 Press ENTER to throw 3 dices (q for exiting): Dice#1 has 5 Dice#2 has 1 Dice#3 has 4 Press ENTER to throw 3 dices (q for exiting): Dice#1 has 4 Dice#2 has 3 Dice#3 has 2 Press ENTER to throw 3 dices (q for exiting): */