代码错误:代码无效

Error in code : Code has no effect

以下是我的代码。此代码在屏幕上移动文本。我正在做一个要在学校提交的项目。遗憾的是,我们的项目必须使用 Turbo C++ 而不是 Visual Studio 或 CodeBlocks。

#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
int main()
{
    for(int fp=0, sp=getmaxx();fp <= (getmaxx()/4)-20, sp >= (getmaxx()/2)+60; fp++, sp--)
    {
        cleardevice();
        setfillstyle(SOLID_FILL,RED);
        bar(320,50,340,170);
        bar(270,100,390,120);
        settextstyle(SCRIPT_FONT,HORIZ_DIR,5);
        outtextxy(fp-125,300,"Welcome To ");
        outtextxy(sp,300,"MedStore");
        delay(10);
    }
    getch();
    return 0;
}

编译器显示错误

The code has no effect

有人可以指导我解决这个错误吗?

这是 for 循环的条件:

fp<=(getmaxx()/4)-20,sp>=(getmaxx()/2)+60

中间的逗号是逗号运算符;它丢弃左侧代码的结果,表达式的结果只是逗号右侧的表达式的值。这就是编译器警告你的意思(这不是正式的错误;代码的含义定义明确,任何拒绝的编译器编译它不符合语言定义)。将其更改为:

fp<=(getmaxx()/4)-20 && sp>=(getmaxx()/2)+60

或对此:

fp<=(getmaxx()/4)-20 || sp>=(getmaxx()/2)+60

取决于代码实际应该做什么。