表示数字

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    while(getline(cin,a)!=NULL)
    {
        string b;
        for(int i=0; i<a.size(); i++)
            if(a[i]<='9'&&a[i]>='0')
            {
                b+='*';
                while(i<a.size()&&a[i]<='9'&&a[i]>='0')b+=a[i],i++;
                i--;
                b+='*';
            }
            else b+=a[i];
        cout<<b<<endl;
    }
    return 0;
}

你可能感兴趣的:(算法)