c语言figure函数 figure函数用法
C语言求解,新手,简单算法!!!!!!!!!
#includestdio.h
我们提供的服务有:成都网站制作、网站设计、微信公众号开发、网站优化、网站认证、三门峡ssl等。为1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的三门峡网站制作公司
void figure(int i,int j,int n,int max,int ans[])
{
if(i==n)
{
int i;
if(!find(ans,n,0) !find(ans,n,1))
return;
if(find(ans,n,0)+find(ans,n,4)+find(ans,n,5)2)
return;
if(find(ans,n,0) find(ans,n,3))
return;
if((!find(ans,n,1) find(ans,n,2)) ||
(find(ans,n,1) !find(ans,n,2)) )
return;
if(find(ans,n,2)+find(ans,n,3) != 1)
return;
if(!find(ans,n,3) find(ans,n,4))
return;
else
{
char buff[]={"ABCDEF"};
printf("作案人是: ");
for(i=0;in;i++)
printf("%c ",buff[ans[i]]);
putchar('\n');
}
return;
}
for(;j=max-n+i;j++)
{
ans[i] = j;
figure(i+1,j+1,n,max,ans);
}
}
int find(int ans[],int n,int value)
{
int i;
for(i=0;in;i++)
if(ans[i] == value)
return 1;
return 0;
}
main()
{
char person[]={"ABCDEF"};
int ans[6];
int i;
for(i=2;i=6;i++)
figure(0,0,i,6,ans);
printf("\n恭喜破案了,呵呵呵呵\n");
}
c语言写一个函数,输入一个十六进制数,输出相应的十进制数
#include stdio.h
long hex2dec(char *p)
{
long x=0;
for(;*p;p++)
{
if(*p='0'*p='9')x=x*16+*p-'0';
else if(*p='A'*p='F')x=x*16+*p-'A'+10;
else if(*p='a'*p='f')x=x*16+*p-'A'+10;
else
{
printf("Data error!\n");
return -1;
}
}
return x;
}
int main()
{
char s[20];
scanf("%s",s);
printf("%sH=%ldD\n",s,hex2dec(s));
system("pause");
return 0;
}
有关C语言
ts=0.001;
sys=tf(50,[0.000046,0.006,1,0]);
dsys=c2d(sys,ts,'z');
[num,den]=tfdata(dsys,'v');
Q=tf(1,[0.20,1]); %Filter
dQ=c2d(Q,ts,'z');
[numQ,denQ]=tfdata(dQ,'v');
F=1;
N=1/F*1/ts;
zz=tf([1],[1 zeros(1,N)],ts);
dz=dQ*zz;
[numz,denz]=tfdata(dz,'v');
Gr=1/(1-dz);
u_1=0;u_2=0;u_3=0;
y_1=0;y_2=0;y_3=0;
ei=0;ei1=0;
ue_1=0;ue_2=0;
ue_N=0;ue_N1=0;ue_N2=0;
e2_N=0;e2_N1=0;e2_N2=0;
e_N1=0;
e1_1=0;
e2_1=0;
for k=1:1:10000
time(k)=k*ts;
rin(k)=1.0*sin(F*2*pi*k*ts);
yout(k)=-den(2)*y_1-den(3)*y_2-den(4)*y_3+num(2)*u_1+num(3)*u_2+num(4)*u_3;
e(k)=rin(k)-yout(k);
ei=ei+e(k)*ts;
up(k)=1.5*e(k)+10*ei;
e1(k)=-denQ(2)*e1_1+numQ(2)*e_N1;
ei1=ei1+e1(k)*ts;
e2(k)=2*e1(k)+1.0*ei1;
ue(k)=0.8187*ue_1+0.1813*ue_N1+e2(k)-0.8187*e2_1;
M=2;
if M==1
u(k)=up(k); %Only using PID
end
if M==2
u(k)=ue(k)+up(k); %Using REP+PID
end
if kN
ue_N=ue(k-N);
e2_N=e2(k-N);
end
if kN+1
ue_N1=ue(k-N-1);
e2_N1=e2(k-N-1);
e_N1=e(k-N-1);
end
if kN+2
ue_N2=ue(k-N-2);
e2_N2=e2(k-N-2);
end
e1_1=e1(k);
e2_1=e2(k);
ue_2=ue_1;
ue_1=ue(k);
u_3=u_2;u_2=u_1;u_1=u(k);
y_3=y_2;y_2=y_1;y_1=yout(k);
end
figure(1);
plot(time,rin,'k',time,yout,'k');
xlabel('time(s)');ylabel('rin,yout');
figure(2);
plot(time,rin-yout,'k');ylabel('error');
xlabel('time(s)');ylabel('error');
figure(3);
plot(time,u,'k');
xlabel('time(s)');ylabel('u');
figure(4);
plot(time,up,'k',time,ue,'k');
xlabel('time(s)');ylabel('up,ue');
输入一个三位数,倒序输出(c语言)
printf("结果是:%d%d%d\n",d,c,b);
输入一个三位数,倒序输出(c语言)
#include lt;stdio.hgt;
main()
{
int n,a,b,c;
scanf("%d",amp;n);
a=n/100;
b=(n/10)%10;
c=n%10;
printf("\n倒序输出结果:%d%d%d",c,b,a);
getch();
}
当前名称:c语言figure函数 figure函数用法
当前URL:http://scyanting.com/article/docssic.html