#include<iostream.h> class m { int i; public: int b; m(int a) { i=a; } int result() { for(int j=1,b=1;j<=i;j++) { b*=j; } return b; } }; void main() { int n; for(int k=0;;k++) { cout<<"请输入一个数"<<endl; cin>>n; m s(n); cout<<"其阶乘为:"<<s.result()<<endl; int l; cout<<"如果想要继续输入,请按1,否则按0"<<endl; cin>>l; if(l) continue; else break; } }