第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

cin.getline在while循環(huán)中的錯(cuò)誤

cin.getline在while循環(huán)中的錯(cuò)誤

C++
hc茶 2018-05-25 00:04:43
#include<iostream> #include<string.h> using?namespace?std; int?main() { ????char?*pWord;? ????char?word[100],newWord[100]; ????int?repeat,pCurrent; ????cin>>repeat; ????cin.ignore(); ????while(repeat--){ ????????cin.getline(word,100); ????????cin>>pCurrent;? ????????pWord=word+pCurrent;//移動(dòng)位數(shù)? ????????if(pCurrent>strlen(word)) ??????????cout<<"error?input"; ????????else ??????{ ????????strncpy(newWord,pWord,strlen(word)-pCurrent/*去除前面的字符*/); ????????cout<<newWord; ???????} ????????cin.ignore();? }? return?0; }我認(rèn)為輸入:3abc def2def abc2會(huì)輸出bc defef abc但是在第二次輸入 def abc時(shí)還沒(méi)有輸入2就直接再次輸出了bc?def搞不懂是由于什么引發(fā)的
查看完整描述

目前暫無(wú)任何回答

  • 0 回答
  • 0 關(guān)注
  • 1141 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)