这是一个子函数,还有几个子函数也出现了一样的问题,怎样修改?

void chabook()
{
int i;
char name[30];
struct book;
cleardevice();
setbkcolor(2);
scanf("%d",s[c].no);
scanf("%d",s[c].d);
scanf("%s",s[c].na);
scanf("%s",s[c].w);
scanf("%d",s[c].day);
scanf("%f",s[c].m);
scanf("%d",s[c].be);
scanf("%d",s[c].send);
s[c].nomber=s[c].be+s[c].send;
printf("\nThe name what you want to find:\n");
scanf("%s",&name);
for(i=0;i<n;i++)
{
if(strcmp(name,s[c].na)==0)
{
printf("\nThe data is:");
pinrtf("\n| Serial number | code book | title | author | publication time | price | inventory | number out | whole |\n",s[i].no,s[i].d,s[i].na,s[i].w,s[i].day,s[i].m,s[i].be,s[i].sent,s[i].nomber");
}
if(i>=n)
printf("\nNO BOOK YOU FIND!\n");
}
printf(" END ,enter 'o' exit");
getchar();
}

中出现non-portable pointer conversion in function chabook的警告。………………有大神帮我弄明白整个大程序最好…………

当年话下
浏览 120回答 2
2回答

慕标5832272

你这个题很明显是pinrtf("\n| Serial number | code book | title | author | publication time | price | inventory | 这出了问题,你要打印的变量以何种格式输出?另外,我不清楚你这个程序是不是你写,按照你的这种写法,其实是想按照某种对齐格式输出比如%16s,所以是不是用“sprintf” 以对齐的方式拷贝到内存里,第一行是序列化,书名等标题,第二行才是序列号,书名的内容。再打印出来更好,还有个snprintf函数,用法差不多,是为了防止越界的。

慕村225694

pinrtf("\n| Serial number | code book | title | author | publication time | price | inventory | number out | whole |\n",s[i].no,s[i].d,s[i].na,s[i].w,s[i].day,s[i].m,s[i].be,s[i].sent,s[i].nomber");这一句:1)printf 拼写错误2)没有格式化标示符3)尾部括号内多了个引号"4)中间的逗号为中文|\n",这个逗号,应该为英文逗号.其他的有n是不是全局变量? book 为什么没有用到?如果还是不行,需要知道s结构体的格式.
打开App,查看更多内容
随时随地看视频慕课网APP