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

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

VC++6.0下關于file.getline()的一個死循環(huán)。

VC++6.0下關于file.getline()的一個死循環(huán)。

C++
未來的開拓者 2017-04-24 13:14:28
代碼如下://vc++6.0下運行。#include <iostream>#include <fstream>#include <stdlib.h>using namespace std;void main(){??? char ch;????????char sten[81]; ????fstream infile;????infile.open("File.txt",ios::in); ????if(infile.fail()){ cout<<"infile error!"; exit(1); } ????fstream outfile("TextFile.txt",ios::out|ios::in);????if(outfile.fail()){ cout<<"outfile error!"; exit(2); } ????while(!infile.eof()){ ? //把File中的小寫字母變?yōu)榇髮?,寫入TextFile。????????? infile.get(ch); ch=toupper(ch); outfile<<ch; ??? } ??????????????? infile.close();??? outfile.flush(); outfile.clear(); ??? outfile.seekg(0,ios::beg); ??? outfile.seekp(0,ios::beg); ??? int i=1;??? while(!outfile.eof()&&i<10){ ?//顯示TestFile的內(nèi)容,無i時會死循環(huán) ??????? outfile.getline(sten,81);????????cout<<i<<sten<<endl;??????? i++;??? } ??? outfile.close();}/*文件File.txt:When Day Is DoneIf the day is done ,If birds sing no more .If the wind has fiagged tired ,Then draw the veil of darkness thick upon me ,Even as thou hast wrapt the earth with The coverlet of sleep and tenderly closed ,The petals of the drooping lotus at dusk.From the traverer,Whose sack of provisions is empty before the voyage is ended ,Whose garment is torn and dust-laden ,Whose strength is exhausted,remove shame and poverty ,And renew his life like a flower underThe cover of thy kindly night .運行后:TextFile.txt:WHEN DAY IS DONEIF THE DAY IS DONE ,IF BIRDS SING NO MORE .IF THE WIND HAS FIAGGED TIRED ,THEN DRAW THE VEIL OF DARKNESS THICK UPON ME ,EVEN AS THOU HAST WRAPT THE EARTH WITH THE COVERLET OF SLEEP AND TENDERLY CLOSED ,THE PETALS OF THE DROOPING LOTUS AT DUSK.FROM THE TRAVERER,WHOSE SACK OF PROVISIONS IS EMPTY BEFORE THE VOYAGE IS ENDED ,WHOSE GARMENT IS TORN AND DUST-LADEN ,WHOSE STRENGTH IS EXHAUSTED,REMOVE SHAME AND POVERTY ,AND RENEW HIS LIFE LIKE A FLOWER UNDERTHE COVER OF THY KINDLY NIGHT ..*/
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 1642 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號