大数乘法(字符串×整数)
#include<iostream>
#include<string>
using namespace std;
string mul_str(string a,int x){//字符串乘以整数
string c;
int jinwei=0;
int cur;
for(int i=a.size()-1;i>=0;i--){
cur=jinwei+(a[i]-'0')*x;
int ans=cur%10;
c.insert(0,1,ans+'0');
jinwei=cur/10;
}
while(jinwei!=0){//多的进位逐个插入
int ans=jinwei%10;
c.insert(0,1,ans+'0');
jinwei/=10;
}
return c;
}
int main(){
int n;
while(scanf("%d",&n)!=EOF){
string c="1";
for(int i=1;i<=n;i++){//阶乘
c=mul_str(c,i);
}
cout<<c<<endl;
}
return 0;
}