亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請問cin.get()語句測試的時候,程序中用的if(i>=2)語句怎么不能讓它停下來接收換行符?

請問cin.get()語句測試的時候,程序中用的if(i>=2)語句怎么不能讓它停下來接收換行符?

一直在奔走 2017-11-27 20:16:44
#include?<iostream> #include?<cstdlib> int?main() { ????using?namespace?std; ????const?int?arsize=?7; ????char?name[arsize]; ????char?dessert?[arsize]; ????int?i=0; ????do{ ????????i++; ????????cout<<"Enter?your?name:\n"; ????????cin.get(name,arsize); ????????if(i>=2) ????????????{?cin.get();} ????????cout<<"Enter?your?favorite?dessert:?\n"; ????????cin.get(dessert,arsize); ????????cout<<"Now?I?have?some?delicious|"<<dessert<<"|for?you?,"<<name<<"?.\n"; ????}while(i<=arsize); ????system("pause"); ??/*?************** ????cin.getline(name,20); ????cout<<"Enter?your?favorite?dessert:\n"; ????cin.getline(dessert,20); ????cout<<"Now?I?have?some?"<<dessert<<"?for?"<<name<<endl; ????*********************/ ????return?0; }運行結果測試如下:
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 1479 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號