int a = 0;scanf("%d", &a);//然后你再控制台输入例如:1234,不就是4为数了。问题在于怎么将这个4位数拆分。int arr[4] = {0};for(){arr[i] = a/(pow(10, i)) % 10;}
望采纳。