while(1) { cout << endl << name1 << " how many of the remaining " << chipCount << " chip(s) would you like (" << chipCount/2 << " max)?"; cin >> inputNum; while(inputNum > chipCount/2) { cout<<"Error: Chips taken must be at most half of the chips. (" << chipCount/2 << "max) "; cin >> inputNum; } if(inputNum <= chipCount/2) { chipCount=chipCount-inputNum; } }