栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

poj 1917 Automatic Poetry

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

poj 1917 Automatic Poetry

#include <iostream>#include <cstdio>#include <string>using namespace std;int main(){    int tc, len1, len2, i, j, pos1, pos2, pos3, pos4;    string input1, input2, s1, s2, s3, s4, s5, s6;    bool flag1, flag2;    cin >> tc;    cin.get();//放在这里才对     while (tc--){          getline(cin, input1);          getline(cin, input2);          s1.clear();          s2.clear();          s3.clear();          s4.clear();          s5.clear();          s6.clear();          flag1 = true;          flag2 = true;          len1 = input1.length();          len2 = input2.length();          for (i = 0; i < len1; i++){   if (input1[i] == '<' && flag1){        flag1 = false;        pos1 = i;   }   else if (input1[i] == '<' && !flag1){        pos3 = i;   }   else if (input1[i] == '>' && flag2){        flag2 = false;        pos2 = i;   }   else if (input1[i] == '>' && !flag2){        pos4 = i;   }          }          for (i = 0; i < pos1; i++){   s5.push_back(input1[i]);          }          for (i = pos1+1; i < pos2; i++){   s1.push_back(input1[i]);          }          for (i = pos2+1; i < pos3; i++){   s2.push_back(input1[i]);          }          for (i = pos3+1; i < pos4; i++){   s3.push_back(input1[i]);          }          for (i = pos4+1; i < len1; i++){   s4.push_back(input1[i]);          }          for (i = 0; i < len2 && input2[i] != '.'; i++){   s6.push_back(input2[i]);          }          cout << s5 << s1 << s2 << s3 << s4 << endl;          cout << s6 << s3 << s2 << s1 << s4 << endl;    }}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/369705.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号