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 } 

 

相关文章:

  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-22
  • 2021-08-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案