/
*厄密多项式计算
*/
int HM(
int n,
int x);
int main()
{
int jj;
jj=HM(
3,
2 );
printf(
"值是%d!\n", jj);
return 0;
}
int HM(
int n,
int x)
{
int u;
if( n<=
0)
{
u =
1;
}
else if( n ==
1 )
{
u =
2*x;
}
else
{
u = (
2*x*HM( n-
1,
x) -
2*(n-
1)
*HM( n-
2,
x));
}
return u;
}
#include <stdio.h>
#include <stdlib.h>
int asctoint(
char *
str);
int main()
{
char a[
7];
int t;
printf(
"输入字符 \n");
gets(a);
t = asctoint(a);
printf(
"转换后的值%d\n", t);
return 0;
}
int asctoint(
char *
str)
{
int value =
0;
while( (*
str) >
'0' && (*
str) <
'9')
{
value *=
10;
value += (*
str) -
'0';
str++;
}
if(*
str !=
'\0')
value =
0;```
return value;
}
转载请注明原文地址: https://www.6miu.com/read-38064.html