软件用的VC6.0,这个循环想实现的是每次输出的位置依次往下,不过只能输出一行也就是第一次运行的结果,程序里position_y 在上面已经给定了初始值
while (t->next)
{
t = t->next;
if(strcmp(t->s, word) == 0)
num++;
if(strcmp(t->s, a) == 0 || t->next==NULL)
{
if(num != 0)
{
char temp2[10];
setbkmode(OPAQUE);
setbkcolor(RGB(0, 255, 0));
settextcolor(RGB(255, 0, 0));
settextstyle(25, 0, _T("楷体"));
sprintf(temp2, "位置: %d , 次数 : %d次", n, num);
outtextxy(200, position_y, temp2);
position_y += 25;
}
n++;
num = 0;
}
}