- #include<iostream>
- #include<cstdlib>
- #include<sstream>
- #include<typeinfo>
- using namespace std;
- int main()
- {
- string str="123.45.6789";
- string res[50];
- string tmp="";
- int j=0;
- for(int i=0;i<str.length();i++)
- {
- if(str==".")
- {
- res[j]=tmp;
- tmp="";
- j++;
- continue;
- }
- tmp+=str[i];
- }
- res[j]=tmp;
- for(int i=0;res[i]!="";i++)
- cout<<res[i]<<endl;
- system("pause");
- return 0;
- }
複製代碼 |