<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>翻轉 on Lin's Blog</title><link>http://coder.tw/tags/%E7%BF%BB%E8%BD%89/</link><description>Recent content in 翻轉 on Lin's Blog</description><generator>Hugo</generator><language>zh-tw</language><lastBuildDate>Sun, 06 Mar 2011 11:18:22 +0000</lastBuildDate><atom:link href="http://coder.tw/tags/%E7%BF%BB%E8%BD%89/index.xml" rel="self" type="application/rss+xml"/><item><title>【C++】數字翻轉、字串翻轉(應用：轉型別、字串處理、迴圈)</title><link>http://coder.tw/posts/c-reverse-number-and-string/</link><pubDate>Sun, 06 Mar 2011 11:18:22 +0000</pubDate><guid>http://coder.tw/posts/c-reverse-number-and-string/</guid><description>&lt;p&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/03/2011-03-06_111510.jpg"&gt;&lt;img class="size-large wp-image-342 aligncenter" title="2011-03-06_111510" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2011/03/2011-03-06_111510-540x382.jpg" alt="" width="540" height="382" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;這算是蠻簡單的題目，就只是做數字or字串的翻轉，例如輸入：linroex會輸出：xeornil或是輸入123會傳回321，這題解法並不難，透過C++裡面字串可以用陣列的方式存取這個特性，我們設定一個迴圈，然後取得輸入字串的長度作為迴圈的結束值，接者當迴圈跑一圈時就把X字串最後一個字移到Y字串第一個字，這樣當迴圈跑完時就翻轉完成了&lt;/p&gt;
&lt;p&gt;</description></item></channel></rss>