返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. string str="123.45.6789";
  4. int data[50];
  5. stringstream ss;
  6. int main()
  7. {
  8.     re:
  9.     replace(begin(str),end(str),'.',' ');
  10.     ss<<str;
  11.     int n,index=0;
  12.     while(ss>>n)
  13.     {
  14.         data[index]=n;
  15.         index++;
  16.     }
  17.     for(int i=0; i<index; i++)
  18.         cout<<data[i]<<endl;
  19.     goto re;
  20.     system("pause");
  21.     system("cls");
  22.     return 0;
  23. }
複製代碼

TOP

返回列表