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

TOP

返回列表