C十十,输入一个整数,判断该数是否包含有重复的数字。

C十十,输入一个整数,判断该数是否包含有重复的数字。C十十
2025-05-22 10:25:25
推荐回答(1个)
回答(1):

#include 
using namespace std;
int main()
{
    int n, f[10]={0}, t=0;
    cin>>n;
    while(n)
    {
        t=n%10;
        if(f[t] == 1) break;
        f[t]=1;
        n/=10;
    }
    if(n) cout<<"have repeate number\n";
    else cout<<"no repeat number\n";
    return 0;
}