首页 > 其他 > 详细

完美世界 字符串倒置输出

时间:2017-09-26 22:00:59      阅读:287      评论:0      收藏:0      [点我收藏+]
 1 #include <iostream>  
 2 using namespace std; 
 3 /* 
 4 字符串倒置输出:
 5 输入: 
 6 123 456 789 00 10
 7 输出: 
 8 10 00 789 456 123
 9 */
10 int main(){
11     string str;
12     getline(cin,str);
13     int count=0;
14     int n=str.length();
15     for(int i=n-1;i>=-1;--i){
16         count++;
17         if(str[i]== ||i==-1){
18             
19             for(int j=i+1;j<i+count;++j){
20                 cout<<str[j];
21                 
22             }
23             if(i!=-1) cout<<" ";
24 
25             count=0;    
26         }
27         
28     }
29 
30 } 

 

完美世界 字符串倒置输出

原文:http://www.cnblogs.com/smuxiaolei/p/7598973.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!