c++ - Strange output in Eclipse CDT counsul -
i'm getting next on eclipse cdt when run program:
there 11 sticks left. 3 come in move:*stopped,reason="end-stepping-range",frame={addr="0x004015b4",func="_fu4___zst3cin",args=[],file="..\src\playeruser\playeruser.cpp",fullname="c:\users\...\desktop\workspace_eclipse\stickgame\src\playeruser\playeruser.cpp",line="26"},thread-id="1",stopped-threads="all" everything "enter move" makes sense, rest not. after comes up, keeps letting me type things in, programme seems frozen.
i have lot of code, here pertinent parts:
main function:
int main() { int sticks = 10; playeruser u(sticks); playercomputer c(sticks); stickgame game (u, c); game.startgame(11); homecoming 0; } function: playeruser::getmove
int playeruser::getmove(int n_left){ int on = 0; while(true){ cout << "there " << n_left << " sticks left." << endl; cout << "enter move:" << flush; //where error occurs cin >> on; if(on <= 3 && on >= 1) break; } setmove(n_left, on); homecoming on; } from i've been able find, seems may have "verbose console mode", don't understand or how prepare it.
i had same problem in debugger every time using cin right after cout, , resolved adding << endl; after cout
bool isdone() { char c; cout << "enter 'y' if nutrient done:"; cin >> c; homecoming ((c == 'y') || (c == 'y')); } this generating error such as:
*stopped,reason="end-stepping-range",frame=... but working fine:
bool isdone() { char c; cout << "enter 'y' if nutrient done:" << endl; cin >> c; homecoming ((c == 'y') || (c == 'y')); } c++ eclipse-cdt cout cin
No comments:
Post a Comment