pdxdsbzl @ 2024-01-19 18:05:00
#include<stdio.h>
#include<string.h>
char ar[100];
char br[10];
int main()
{
int n;
scanf("%d",n);
int u,v;
char y;
for(int i=0;i<n;i++)
{
scanf("%s",br);
if(br[0]>='a'&&br[0]<='z')
{
scanf("%d%d",&u,&v);
y=br[0];
}
else
{
sscanf(br,"%d",&u);
scanf("%d",&v);
}
memset(ar,0,sizeof(ar));
if(y=='a')
{
sprintf(ar,"%d+%d=%d",u,v,u+v);
}
else if(y=='b')
{
sprintf(ar,"%d-%d=%d",u,v,u-v);
}
else if(y=='c')
{
sprintf(ar,"%d*%d=%d",u,v,u*v);
}
printf("%s\n",ar);
printf("%d",strlen(ar));
}
return 0;
}
by TimSwn090306 @ 2024-01-19 18:29:19
@pdxdsbzl scanf n 那行要加取址符号 &
by pdxdsbzl @ 2024-01-19 18:43:10
@TimSwn090306 谢谢谢谢谢谢谢谢啊哈哈哈哈哈我真是个大**哈哈哈