Tried several times found that cin. The clear () and (cin) sync () and can't clear buffer
But there are bosses provides another way
STD: : cin. Ignore (STD: : numeric_limits & lt; STD: : streamsize> : : Max (), '\ n');
//https://blog.csdn.net/weixin_43669941/article/details/90233667? Ops_request_misc=% 257 b % 2522 request 255 fid 253 a % 2522161927343016780271537666% % 2522% % 2522% % 252 c 2522 SCM 253 a % % 2522% 252220140713.130102334.. % 2522% 257 d & amp; Request_id=161927343016780271537666 & amp; Biz_id=0 & amp; Utm_medium=distribute. Pc_search_result. None - task - blog - 2 ~ ~ baidu_landing_v2 ~ all default - 2-90233667. First_rank_v2_pc_rank_v29 & amp; Utm_term=cin. Sync E6 A0 % E6%95% % 97% % 88
Want to ask the numeric_limits and streamsize what is the meaning of
There is also a big provides this way
While (cin. The get ()!='\ n');
CodePudding user response:
Numeric_limits said some type of size, streamsize is long longTherefore numeric_limits & lt; Streamsize> : : Max () retrieves the maximum number of long long
The use of the cin. Ignore see blog.csdn.net/wxbmelisky/article/details/48596881
CodePudding user response:
VS the IDE in don't understand the symbol on the right mouse button, choose to define,