struct File
{
char title[51];
char content[102][51];
}file[100];
int main()
{
int a=1, b, c, d, e;
for (b = 0; b < a; b++) //输入文件
{
c = 0;
gets(file[b].title);
while (file[b].content[c] != '#')
{
gets(file[b].content[c])
c++;
}
}
for (b = 0; b < a; b++)
{
printf("%s\n", file[b].title);
for (c = 0;; c++)
{
printf("%s\n", file[b].content[c]);
if (file[b].content[c] == '#')
{
break;
}
}
}
c语言的题目
搞了很多种方法了没法解决,帮忙看看(っ °Д °;)っ
file[b].content[c] 是字符串,怎么能跟字符比?
用strcmp()
改成
if (file[b].content[c][0] == '#')