It is necessary to ask the user if he is sure of the number of threads that he entered
while (true) { int newThreadCount; string choice; cout << "Количесво потоков: "; cin >> newThreadCount; cout << endl; if (newThreadCount > boost::thread::hardware_concurrency()*2) { cout << "Указанное количество потоков сильно превышает количество ядер процессора, прироста производительности не будет. Продолжить? (y\n)"; while (true) { getline(cin, choice); if (choice == "n") break; else if (choice == "y") break; } } } *Код, выполняемый после подтверждения* How to organize a confirmation (y \ n)? If you entered y , then the code should continue, if n - should repeatedly ask for the number of threads, if it entered not y \ n, then the code should require you to enter y or n .
returnor exit the program in another way. The outer loop is short-closed - you need to change, or even remove it, or set the exit condition from the loop using newThreadCount. - nick_n_a February