返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string str="123.45.6789";
  7.     str+=".";
  8.     string res[50];
  9.     int index=0;
  10.     string tmp="";
  11.     for(int X=0; X<str.size(); X++)
  12.     {
  13.          if(str[X]=='.')
  14.          {
  15.              res[index]=tmp;
  16.              tmp="";
  17.              index++;
  18.          }else
  19.          {
  20.              tmp+=str[X];
  21.          }
  22.     }
  23.     for(int X=0; res[X]!=""; X++)
  24.         cout<<res[X]<<endl;
  25.     system("pause");
  26.     return 0;   
  27. }
複製代碼

TOP

返回列表