{ if(array[i]==*pt) return 1; i++; } return 0; }
void T::print() { cout<<"->"<<*pt; }
int T::check() { if(*pt==1) return 1; else return 0; }
void main() { int N; cout<<"Please input an integer larger than zero!\n"; cout<<"Start:"; cin>>N; while(N) { T d(N); cout<<N; do { d.next(); if(!d.repeat()) d.print(); else { if(d.check()) count++; break; } }while(1); cout<<endl; N--; } cout<<"The number of digit-string ending with 1 is: "<<count<<endl; }
测试数据(输入、输出)