<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 把過長的行輸入縮短換行輸出

          把過長的行輸入縮短換行輸出

          作者: 時間:2016-11-28 來源:網絡 收藏
          原題:Write a program to ``fold long input lines into two or more shorter lines after the last non-blank character that occurs before the n-th column of input. Make sure your program does something intelligent with very long lines, and if there are no blanks or tabs before the specified column.
          縮短行輸入,不涉及特殊情況的考慮,不算難。但題目要求考慮特殊情況,防止輸入中空白的開頭和結尾在縮短輸出之后難以分辨,要進行區(qū)別處理。不僅實現有難度,而且假如全文大部分都是縮進符和空格,按照題目的要求,怎么做都難以分辨。后來擅自改變題意(假如是改變客戶要求,是不是要商討半天了),以特殊符號一頭一尾括住輸出,實現分辨。



          執(zhí)行效果(回車結束輸入):

          實現了自己的想法,就是違背了原題……。思考方向對的時候,解決問題比較快。但是還沒總結出一套思考流程……,靠運氣。


          關鍵詞: 行輸入換行輸

          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();